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
<form id="form1" method="post" autocomplete="off"> <form id="form2" method="post" autocomplete="off">
showErrors: function (errorMap, errorList) {
var errors = this.numberOfInvalids();
if (errors) {
$('section#form2').hide(300);
$('#button_submit[type="submit"]').click(function() {
if ($('#button_submit[type="submit"]').on(':click')) {
$('section#form2').hide(300);
}
});
}
this.defaultShowErrors();
},