I have following code
$("#Form").validate({
errorPlacement: function(error, element) {
element.addClass('errorField');
element.after(error);
},
rules: {
...
}
});
The errorPlacement function is setting a css class errorField to the element when it fails the described rules and every time before validation I want to remove this class errorField.
element.removeClass('errorField');
So my question, is there any event in jquery.validate that fires before the validation took place?
so if that element is hosting this class errorField, the above code will remove the class from this element and will re-validate the field and may apply this class again if the field fails the rules again.
This may also done in any event that fires after the validation so if the element passes the rule I will remove the class errorField.
Note: errorField is a css class that will highlight the field to notify the user about the error