Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11904 closed bug (invalid)

'change' event no triggered if you modify `val()` by code

Reported by: [email protected] Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:

Description

If I have a textfield with a handler listening to "change" event it is not triggered if I do it by code.

For example:

$('#size').on( "change", function(){ console.log( "size changed" ); } );

$('#size').val( "small" );

This does not "trigger" the event handler.

jsFiddle: http://jsfiddle.net/fguillen/TRCk7/

Change History (3)

comment:1 Changed 11 years ago by Fernando Guillen <[email protected]…>

As is said [here](http://stackoverflow.com/questions/7055729/onchange-event-not-fire-when-the-change-come-from-antoher-function/7055771#7055771) this is the proper behavior following the HTML specifications but still I think it is not the behavior expected for a JS programer perspective.

comment:2 Changed 11 years ago by dmethvin

Resolution: invalid
Status: newclosed

Well we should follow the spec or you can lobby them to change it. You can always .trigger("change").

comment:3 Changed 11 years ago by Fernando Guillen <[email protected]…>

I accept and understand.

Note: See TracTickets for help on using tickets.