good! I'm pretty new with javascript and I'm having a serious problem validating and redirecting the input. This is my html code:
<div class="grid-container">
<a href="index.html" class="back"><span></span> < </a>
</div>
<div class="flex-container-registro">
<div class="cuadroAzul">
<p>REGISTRATE<br/>
Ahora crea tu codigo de seguridad</p>
</div>
<form class="registro" id="rCod" onsubmit="return registroCs()" >
<input type="text" class="security" maxlength="1" id="rCod1" required>
<input type="text" class="security" maxlength="1" id="rCod2" required>
<input type="text" class="security" maxlength="1" id="rCod3" required>
<input type="text" class="security" maxlength="1" id="rCod4" required>
<div class="infoRegistro">
<p>Recordalo, lo vas a necesitar siempre que necesites Cargar Saldo</p>
</div>
<input class="botonRegistro" type="submit" value="Continuar" id="ContinuarRegistro" >
</form>
</div>
this is my code js
function registroCs(){
cs1= document.getElementById("rCod1").value;
cs2= document.getElementById("rCod2").value;
cs3= document.getElementById("rCod3").value;
cs4= document.getElementById("rCod4").value;
if ( cs1.length > 1 || cs2.length > 1 || cs3.length > 1 || cs4.length > 1 ) {
error= true;
} else if (cs1 != "" && cs2 != "" && cs3 != "" && cs4 != ""){
error= false;
}
if (error == false) {
alert("a otro lado");
document.location.href = "registro2.html";
return true;
}
}
if anyone has an idea why it does not generate the redirection to the next page and can share it would be very helpful