I\'m using the Jquery Validation plugin on a project.
By default, the plugin validates input when the submit button is clicked. The behavior is \"lazy\" in order to
I wanted to add to Robert's answer that you can do this in the default settings by using setDefaults() so it doesn't rely on tapping into the actual instance of the validate method (which is not typically exposed with unobtrusive validation).
Just override the onfocusout property with a function that always evaluates the blurred element by calling the valid() method:
// enable eager evaluation
$.validator.setDefaults({
onfocusout: function (element) {
$(element).valid();
}
})
Demo With Eager Evaluation:
(Will show required after tab out)
// enable eager evaluation
$.validator.setDefaults({
onfocusout: function (element) {
$(element).valid();
}
});
$("form").validate();
input.error {
border-color: red
}
Normal Demo
(Won't show required until submit)
$("form").validate();
input.error {
border-color: red
}