0

Como faço para não executar a outra função se uma for verdadeira?

Exemplo: Function 1 se uma senha tiver menos que 2 caracteres execute um alert Function 2 se a senha não for igual a senha2 execute um alert...MAS! quero q execute primeiro a função 2 dando prioridade a ela e se ela aparecer a outra não aparece

27th Sep 2016, 9:42 PM
Gileade Lima
Gileade Lima - avatar
1 Answer
0
<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <input id="pass" type="password"> <input id='butt' type="submit"> <script> butt.addEventListener('click', function() { var pass = document.getElementById('pass').value; var butt = document.getElementById('butt'); var pass2 = "secret" //inspection if(pass === pass2) { alert("Hello"); } else if(pass !== pass2) { alert("Password is not equal to password2"); } if(pass.length < 2) { alert("Password must be > 2"); } }); </script> </body> </html> i think it will come to you
27th Nov 2016, 2:50 PM
alexyork
alexyork - avatar