Skip to content

Commit

Permalink
Changed lastElement to lastActive in keyup, skip validation on tab or…
Browse files Browse the repository at this point in the history
… empty element. Fixes #244
  • Loading branch information
mlynch authored and jzaefferer committed Apr 28, 2012
1 parent 43d963b commit c41f2f6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion jquery.validate.js
Expand Up @@ -234,7 +234,9 @@ $.extend($.validator, {
}
},
onkeyup: function(element, event) {
if ( element.name in this.submitted || element === this.lastElement ) {
if ( event.which == 9 && this.elementValue(element) === '' ) {

This comment has been minimized.

Copy link
@staabm

staabm Mar 25, 2014

Member

@jzaefferer is there a config switch or something like that to enable validation when user jumps between fields with TAB? ATM the required fields are only checked on validate().form() call, not while typing...

return;
} else if ( element.name in this.submitted || element === this.lastActive ) {
this.element(element);
}
},
Expand Down

1 comment on commit c41f2f6

@STRUDSO
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As fare as i can see then the lastElement is not in use anymore, then why not get ride of it, or am i missing something?

Please sign in to comment.