Asia

jQuery Confirm Password Validation

jQuery Confirm Password Validation

Tudip

24 June 2016


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.
Now few people might think, it is overkill and it can be done with Rules. But as in long run, you would have to learn to add your own validations anyway, why not start with the simplest thing? 🙂
If you face problems, do drop us a line and we can help you out.
Happy Coding!!

Tudip Technologies

Tudip Technologies is a value-driven Software Services company. We deliver excellence in dedicated and business-centric web solutions incorporated with innovation and expertise as the tools to achieve business goals. Our high-quality, cost-effective, reliable, and scalable services have helped us build an enduring relationship with our clients and customers.

Latest Posts

  • All Posts
  • Casestudy
  • Cloud
  • Healthcare
  • Ios
  • IOT
  • Java
  • Manufacturing
  • News
  • OTT
  • Supply Chain
  • Support and Maintainance
    •   Back
    • Banking
Cloud-Powered Agility

December 27, 2024

27 December 2024 Introduction: Transforming Chaos into Opportunity Imagine a supply chain where disruptions are predicted before they occur, inventory…

Cloud-Powered Agility

December 24, 2024

Imagine a supply chain where disruptions are predicted before they occur, inventory is optimized in real-time, and every stakeholder works…

Related Posts

  • All Posts
  • Healthcare