Jquery validation plugin (bassistance.de) and validation on tab for empty fields
I see a duplicate question about this but with no accepted answers: jQuery Validation PlugIn : Forcing Validation on empty Field
There is a comment on the linked post that validation on tabbing won't work without editing the plugin开发者_开发知识库. Does anybody have any solutions or workaround to get the validation plugin to fire on tabbing through empty fields?
I've tried the event option, passing in 'blur', 'keydown','keyup', etc.
Has anyone come up with a patch or workaround?
Thanks!
Ah, I see now, you just need to call valid()
on an element and all children inputs will be validated.
I decided to add validation to the blur event and tab
$("input").blur(function() {
$(this).valid();
})
$("input").keydown(function(e) {
var code = (e.keyCode ? e.keyCode : e.which);
if(code == 9) { //Enter keycode
$(this).valid();
}
})
精彩评论