Skip to content

Commit 7eef91e

Browse files
committed
Update jquery.validation.net.webforms.js
Clarified method comments.
1 parent 51cb166 commit 7eef91e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

jquery.validation.net.webforms.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@
2929
// wire up the default jquery validation event to the form
3030
this.validate(options);
3131

32-
// Select any input[type=text] elements within a validation group
32+
// Select all input elements in form
3333
// and attach keydown handlers to all of them.
3434
$('.form :input').keydown(function (event) {
35-
// Only execute validation if the key pressed was enter.
35+
// Cause the form to validate when the enter key is pressed.
36+
// It is a requirement to catch the enter key press as the default
37+
// browser action would submit the form bypassing the validation event thus validating all groups.
3638
if (event.keyCode == 13) {
3739
$(event.currentTarget).closest(".form").find(".submit").click();
3840
return false;
@@ -80,4 +82,4 @@
8082
}
8183
});
8284

83-
})(jQuery);
85+
})(jQuery);

0 commit comments

Comments
 (0)