chandan111
chandan111

Reputation: 251

JQuery confirm password validation not working

I am using a jquery validation plugin for checking form validation. here is code

New User? Register Here!

Username


Password


Confirm Password


Email


Submit

jQuery.validator.addMethod("word_check", function(value, element) {
    return this.optional(element) || /^[a-zA-Z0-9-_]+$/i.test(value);
}, "special characters/spaces not allowed");
$(document).ready(function(){
    $("#register").validate({
        errorElement: 'div',
        rules:{
           "Username":{
            required: true,     
            minlength:5,
            word_check : true
          },
        "password":{
             required:true,
             minlength:5
        },
        "Confirm_Password":{
            required:true,
            equalTo: "#password"
        },
        "email":{
             required: true,
             email: true
        }
    }    
  });  
 });

it's working but it always show "password not match error, instead of same password"

Upvotes: 1

Views: 710

Answers (1)

mcendon
mcendon

Reputation: 11

Check if the password field has id="password" name="password" and the 2nd field "Confirm_Password" has name="Confirm_Password"

Upvotes: 0

Related Questions