onkeyup and onfocusout is not working in jQuery Validate
Solution 1:
You would never use the .valid()
method within the .validate()
method. Refer to the source code of onkeyup
and onfocusout
to see how it's done.
Use this.element(element)
instead of $(element).valid()
To over-ride the default functionality ("lazy validation") of onkeyup
and onfocusout
and use "eager" validation instead...
$('#myform').validate({
onkeyup: function(element) {
this.element(element); // <- "eager validation"
},
onfocusout: function(element) {
this.element(element); // <- "eager validation"
}
....
DEMO: http://jsfiddle.net/ajy5j8jq/