Skip to main content

Bug Tracker

Side navigation

#11904 closed bug (invalid)

Opened June 13, 2012 11:07PM UTC

Closed June 14, 2012 12:13AM UTC

Last modified June 14, 2012 01:06AM UTC

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

Reported by: fguillen.mail@gmail.com 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/

Attachments (0)
Change History (3)

Changed June 13, 2012 11:15PM UTC by Fernando Guillen <fguillen.mail@gmail.com> comment:1

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.

Changed June 14, 2012 12:13AM UTC by dmethvin comment:2

resolution: → invalid
status: newclosed

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

Changed June 14, 2012 01:06AM UTC by Fernando Guillen <fguillen.mail@gmail.com> comment:3

I accept and understand.