Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#11793 closed bug (duplicate)

trigger('change') on a disabled input do not trigger filtered listener .on('change', 'input', ...)

Reported by: pierre.gotab@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:


Let $input be a disabled input in a $form. A call to $input.trigger('change') wont fire a listener set up with $form.on('change', 'input', function(){...}) but will fire a listener set up with $form.on('change', function(){...}).

Here: http://jsfiddle.net/LAuBz/

Change History (4)

comment:1 Changed 9 years ago by dmethvin

Resolution: duplicate
Status: newclosed

comment:2 Changed 9 years ago by dmethvin

Duplicate of #11382.

comment:3 Changed 9 years ago by anonymous

What I understand from the duplicate state is that jQuery is consistent with the (incredibly retarded) fact that some browsers do not trigger some events on disabled inputs (mouse events and - apparently - change events).

But a listener set on a parent can catch the 'change' event so this event is actually created and bubbled?!

Finally, t seems like:

.on(type, selector, function)

is different from:

.on(type, function(evt){ if(!$(evt.target).is(selector)) return; ... })

in this situation. Not a really clear behavior... and not documented in http://api.jquery.com/on/

Besides, the W3C never said that events don't fire on disabled inputs, and the note at the end of http://www.w3.org/TR/html4/interact/forms.html#h-17.12.1 let us think that scripts can operate on disabled inputs and therefore events should fire and bubble normally. I hope jQuery goal is not to conform to creepy browser's implementations but to offer to the javascript programmer a smart interface to that crap. Thank you for your work btw :)

comment:4 Changed 9 years ago by dmethvin

If you want to contribute, please don't post on duplicate tickets. You can see the duplicate is assigned, right? None of this comment adds anything to useful discussion on that ticket so please don't add it there.

Note: See TracTickets for help on using tickets.