How to attach an ID to the showErrors: function in jquery validation plugin

How to attach an ID to the showErrors: function in jquery validation plugin

I am using the jquery validation plugin. I have a "showErrors" function to hide a second form on error, and on click of the submit button if the user goes back and modifies the first form and creates new errors.

The problem is the second form is also taking on the "showErrors" function. It is hiding when the user clicks the submit for that form as well.

I want to attach an ID (#form1) to the "showErrors" function so it ONLY works with the first form. I need to make sure ID (#form2) Does not trigger the "showErrors" function.

Does anybody know how to attach a (form1) ID to this function to stop other forms from triggering?


Thanks


  1. <form id="form1" method="post" autocomplete="off"> <form id="form2" method="post" autocomplete="off"> 





  1.  showErrors: function (errorMap, errorList) {
  2. var errors = this.numberOfInvalids();
  3. if (errors) {
  4. $('section#form2').hide(300); 
  5. $('#button_submit[type="submit"]').click(function() {
  6. if ($('#button_submit[type="submit"]').on(':click')) {
  7. $('section#form2').hide(300);
  8. }
  9. });
  10. }
  11. this.defaultShowErrors();
  12. },