如何使用jquery验证密码一致问题
<li><spanclass="zc_name">密码:</span><inputtype="password"class="zc_textrequired"id="pa...
<li>
<span class="zc_name"> 密码: </span>
<input type="password" class="zc_text required" id="password" name="password" />
<span class="zc_tip"> <font color="red">*</font> <span id="showPwd">由6-16位字符组成,请使用英文字母、符号或数字。</span><span class="OK1 passwordok"><img id="passwordok" src="/css/images/yes.gif" /></span><span class="no1 passwordfail"><img id="passwordfail" src="/css/images/no.gif" /></span></span>
</li>
<li>
<span class="zc_name"> 确认密码: </span>
<input type="password" class="zc_text required" id="password2" equalTo="#password" name="password2" "/>
<span class="zc_tip"> <font color="red">*</font> <span id="showPwd1">为了您记住输入的密码,请再次输入密码</span><span class="OK1 passwordok"><img id="passwordok" src="/css/images/yes.gif" /></span><span class="no1 passwordfail"><img id="passwordfail" src="/css/images/no.gif" /></span></span>
</li>
求验证密码是否一致的jquery代码(是失去焦点时执行,不是提交后) 展开
<span class="zc_name"> 密码: </span>
<input type="password" class="zc_text required" id="password" name="password" />
<span class="zc_tip"> <font color="red">*</font> <span id="showPwd">由6-16位字符组成,请使用英文字母、符号或数字。</span><span class="OK1 passwordok"><img id="passwordok" src="/css/images/yes.gif" /></span><span class="no1 passwordfail"><img id="passwordfail" src="/css/images/no.gif" /></span></span>
</li>
<li>
<span class="zc_name"> 确认密码: </span>
<input type="password" class="zc_text required" id="password2" equalTo="#password" name="password2" "/>
<span class="zc_tip"> <font color="red">*</font> <span id="showPwd1">为了您记住输入的密码,请再次输入密码</span><span class="OK1 passwordok"><img id="passwordok" src="/css/images/yes.gif" /></span><span class="no1 passwordfail"><img id="passwordfail" src="/css/images/no.gif" /></span></span>
</li>
求验证密码是否一致的jquery代码(是失去焦点时执行,不是提交后) 展开
展开全部
<script>
$(function(){
$("#password2").blur(function(){
if($(this).val()==$("#password").val()){
$("#passwordok").show();
$("#passwordfail").hide();
} else {
$("#passwordfail").show();
$("#passwordok").hide();
}
})
})
</script>
$(function(){
$("#password2").blur(function(){
if($(this).val()==$("#password").val()){
$("#passwordok").show();
$("#passwordfail").hide();
} else {
$("#passwordfail").show();
$("#passwordok").hide();
}
})
})
</script>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询