Validation plug-in: Stops validating when a valid response is changed to invalid?
I am stuck on a problem with the jquery.validate.js plug-in.
The field-level validation works fine until the user changes a value that was valid to an invalid value. When the user leaves focus of the field, the add/remove class (errorPlacement function) does not kick in.
I assume it is because "success" was hit once and it is no longer validating the field.
How can I get the code to continue to run the function under errorPlacement when an invalid value is entered?
$.validator.setDefaults({
debug: true,
errorElement: "span",
errorPlacement: function(error, element) {
error.appendTo(element.parent("div").children(".fielderrorholder")); // i don't display the error msg.
element.parent("div").removeClass("validatesuccess");
element.parent("div").addClass("validateerror");
},
success: function(label) {
label.parent("div").parent("div").removeClass("validateerror");
label.parent("div").parent("div").addClass("validatesuccess");
}
}
});
Thank you for your help.