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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -