Skip to content

Commit aa6c72c

Browse files
committed
Core: trigger events for elements outside their form
1 parent 793ef9a commit aa6c72c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/core.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,15 @@ $.extend( $.validator, {
424424
// Support: Chrome, oldIE
425425
// "select" is provided as event.target when clicking a option
426426
.on( "click.validate", "select, option, [type='radio'], [type='checkbox']", delegate );
427+
$( this.currentForm.elements ).filter( function( i, el ) {
428+
return $(el).closest(el.form).length === 0;
429+
} )
430+
.filter(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], " +
431+
"[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], " +
432+
"[type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], " +
433+
"[type='radio'], [type='checkbox'], [type='button']")
434+
.on( "focusin.validate focusout.validate keyup.validate", delegate).end()
435+
.filter("select, option, [type='radio'], [type='checkbox']").on( "click.validate", delegate);
427436

428437
if ( this.settings.invalidHandler ) {
429438
$( this.currentForm ).on( "invalid-form.validate", this.settings.invalidHandler );

0 commit comments

Comments
 (0)