Reputation: 251
I am using a jquery validation plugin for checking form validation. here is code
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
Reputation: 11
Check if the password
field has id="password" name="password"
and the 2nd field "Confirm_Password"
has name="Confirm_Password"
Upvotes: 0