Response title
This is preview!
check showErrors function
showErrors
Type: Function()A custom message display handler. Gets the map of errors as the first argument and an array of errors as the second, called in the context of the validator object. The arguments contain only those elements currently validated, which can be a single element when doing validation onblur/keyup. You can trigger (in addition to your own messages) the default behaviour by calling this.defaultShowErrors().Example: Update the number of invalid elements each time an error is displayed. Delegates to the default implementation for the actual error display.
12345678$(".selector").validate({
showErrors: function(errorMap, errorList) {
$("#summary").html("Your form contains "
+ this.numberOfInvalids()
+ " errors, see details below.");
this.defaultShowErrors();
}
});
The callback gets passed two arguments:
showErrors: function(errorMap, errorList) {
$.each(errorList, function(index, value) {
var message = value.message;
var position = index;
$.each(errorList, function(index, value) {
if (value.message = message) {
if (index != position) {
errorList.splice(index, 1)
}
})
})
}
© 2013 jQuery Foundation
Sponsored by and others.