Bug Tracker

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#9274 closed bug (duplicate)

The click handler for a checkbox is called before the checked property is updated when triggering the click event with trigger()

Reported by: sime.vidas@… Owned by:
Priority: low Milestone: 1.next
Component: event Version: 1.6
Keywords: Cc:
Blocked by: Blocking:

Description

Given a check-box and a click handler bound to it, if we use trigger('click') on that checkbox, the click handler will be called BEFORE the checked property is updated.

The jsFiddle is here: http://jsfiddle.net/H7qry/2/

Now, you could say that this is inevitable if you trigger the click event programmatically. However, if we use the built-in click() method to trigger the event, then this issue is NOT PRESENT.

See here: http://jsfiddle.net/H7qry/3/

Change History (6)

comment:1 Changed 5 years ago by rwaldron

  • Component changed from unfiled to event
  • Priority changed from undecided to low
  • Resolution set to worksforme
  • Status changed from new to closed

The correct event to listen for a change in the state of a checkbox is oddly enough "change".. not click.

http://jsfiddle.net/rwaldron/H7qry/4/

Version 0, edited 5 years ago by rwaldron (next)

comment:2 Changed 5 years ago by anonymous

@rwaldon The comment here is about triggering events not listening for them.

comment:3 Changed 5 years ago by rwaldron

#9595 is a duplicate of this ticket.

comment:4 Changed 5 years ago by dmethvin

  • Resolution worksforme deleted
  • Status changed from closed to reopened

comment:5 Changed 5 years ago by dmethvin

  • Resolution set to duplicate
  • Status changed from reopened to closed

comment:6 Changed 5 years ago by dmethvin

Duplicate of #3827.

Note: See TracTickets for help on using tickets.