jquery验证再次密码不同
$(".spwdtwo").blur(function(){varspwdtwo=$(this).val().replace(/[]/g,"");varpwd=docum...
$(".spwdtwo").blur(function(){
var spwdtwo = $(this).val().replace(/[ ]/g,"");
var pwd=document.getElementById("spwd");
var pwd2=document.getElementById("spwdtwo");
if(spwdtwo==""){
$(".name_info3").html("<span>请再次密码!</span>");
}else if(pwd2!=pwd){
$(".name_info3").html("<span> 密码不同!</span>");
}else
{
alert('密码相同');
$(".name_info3").html("<span style='color:#3739BC'>√</span>");
}
});
<tr>
<td class="star">*</td>
<td>学校密码:</td>
<td><input type="password" name="school.schoolPwd" id="spwd" class="spwd" size="40"/></td>
<td><span class="name_info2"></span></td>
</tr>
<tr>
<td class="star">*</td>
<td>确认密码:</td>
<td><input type="password" name="spwdtwo" id="spwdtwo" class="spwdtwo" size="40"></td>
<td><span class="name_info3"></span></td>
</tr>
可以判断为空和密码不同,但是第二次输入密码相同,不弹出密码相同。求解 展开
var spwdtwo = $(this).val().replace(/[ ]/g,"");
var pwd=document.getElementById("spwd");
var pwd2=document.getElementById("spwdtwo");
if(spwdtwo==""){
$(".name_info3").html("<span>请再次密码!</span>");
}else if(pwd2!=pwd){
$(".name_info3").html("<span> 密码不同!</span>");
}else
{
alert('密码相同');
$(".name_info3").html("<span style='color:#3739BC'>√</span>");
}
});
<tr>
<td class="star">*</td>
<td>学校密码:</td>
<td><input type="password" name="school.schoolPwd" id="spwd" class="spwd" size="40"/></td>
<td><span class="name_info2"></span></td>
</tr>
<tr>
<td class="star">*</td>
<td>确认密码:</td>
<td><input type="password" name="spwdtwo" id="spwdtwo" class="spwdtwo" size="40"></td>
<td><span class="name_info3"></span></td>
</tr>
可以判断为空和密码不同,但是第二次输入密码相同,不弹出密码相同。求解 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询