forms - jQuery Password match validation - Error message doesn't hide -
working on basic registration form. user supposed type in password, type in again , they're typing 'confirm password' box, should "passwords must match" if don't , not show error if match. it'll load no error displayed, , it'll show error while typing confirm box, after matching password put in error doesn't go away. need fix?
jquery script:
$(":password").change(function(){ if($("#passconfirm").val() != $("#password").val() ){ $("#matchtext").show() } else{ $("#matchtext)").hide(); } });
relevant section of form:
password: <input type="password" id="password" placeholder="password" > </br> </br> confirm password: <input type="password" id="passconfirm" placeholder="password" > <span class="error" id="matchtext" style="display:none;">passwords must match.</span>
you have typo in code:
$("#matchtext)").hide();
should be
$("#matchtext").hide();
since id #matchtext
not #matchtext)
.
Comments
Post a Comment