-1
I am making a form, where the "send" data button needs to check the number of digits and check if it is equal to another password.
Html code
<div class="content">
<input type="submit" class="botao01" onclick="Salvar();" value="Salvar" />
</div>
Javascript
function Salvar(){
var senha1 = document.f1.senha1.value;
var senha2 = document.f1.senha2.value;
if(senha1 === senha2){
alert("SENHAS IGUAIS");
}else{
alert("SENHAS DIFERENTES");
}
if(senha.lenght>=6){
alert("Dígitos minimo é 6");
}
}
But it’s not checking...
Aline, review your question. HTML is incomplete and does not say what the purpose of the function
Salvar()
and how you are using it. In addition to there are errors such as the variablesenha
that does not exist and if you want to have at least 6 characters, the correct would be to use<6
(less than 6) and not>=6
(greater than or equal to 6).– Sam
<div class="input-div" id="input-password1"><b>Password:</b> <input type="password" required id="password1" name="password1" placeholder="Enter password " /> </div>
– Liih