Skip to main content

Bug Tracker

Side navigation

#9274 closed bug (duplicate)

Opened May 13, 2011 05:06PM UTC

Closed November 18, 2011 03:16PM UTC

Last modified November 18, 2011 03:16PM UTC

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@gmail.com 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/

Attachments (0)
Change History (6)

Changed May 13, 2011 05:36PM UTC by rwaldron comment:1

_comment0: 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/1305308232889665
component: unfiledevent
priority: undecidedlow
resolution: → worksforme
status: newclosed

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

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

Changed May 14, 2011 08:18AM UTC by anonymous comment:2

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

Changed June 15, 2011 07:47PM UTC by rwaldron comment:3

#9595 is a duplicate of this ticket.

Changed November 18, 2011 03:16PM UTC by dmethvin comment:4

resolution: worksforme
status: closedreopened

Changed November 18, 2011 03:16PM UTC by dmethvin comment:5

resolution: → duplicate
status: reopenedclosed

Changed November 18, 2011 03:16PM UTC by dmethvin comment:6

Duplicate of #3827.