Bug Tracker

Modify

Ticket #11904 (closed bug: invalid)

Opened 11 months ago

Last modified 11 months ago

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

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

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

comment:1 Changed 11 months ago by Fernando Guillen <fguillen.mail@…>

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 months ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

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

comment:3 Changed 11 months ago by Fernando Guillen <fguillen.mail@…>

I accept and understand.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.