OK, so you have created that fancy registration form and now you want to add a validation where password and confirm password fields match. You add the JQuery validate JS and then you realize that there is no inbuilt function for confirm password in the JQuery validate framework 🙂
Follow the steps mentioned below and you can get this working.
$.validator.addMethod('c_password', function(value){
if(value == $('#password').val()){
return true;
}
return false;
}, "Password and confirm password fields do not match");
And give ‘c_password’ class to the confirm password field and change the validation message as per your requirements.
If you face problems, do drop us a line and we can help you out.
Happy Coding!!