html:
<input id="pwd1" type="password" placeholder="设置登录密码" class="in_input">
<input id="pwd2" type="password" onkeyup="validate()" placeholder="重复登录密码" class="in_input" >
js:
function validate() {
var pwd1 = document.getElementById("pwd1").value;
var pwd2 = document.getElementById("pwd2").value;
// 对比两次输入的密码
if(pwd1 == pwd2) {
$('.loginbox_login').off().on('click',function(){
console.log('密码一样,点击注册跳转');
})
}
else {
$('.loginbox_login').off().on('click',function(){
alert('登录密码不一致,请重新输入!');
})
}
}