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 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: | unfiled → event |
| priority: | undecided → low |
| resolution: | → worksforme |
| status: | new → closed |
Changed May 14, 2011 08:18AM UTC by comment:2
@rwaldon The comment here is about triggering events not listening for them.
Changed November 18, 2011 03:16PM UTC by comment:4
| resolution: | worksforme |
|---|---|
| status: | closed → reopened |
Changed November 18, 2011 03:16PM UTC by comment:5
| resolution: | → duplicate |
|---|---|
| status: | reopened → closed |
The correct event to listen for changes in the state of a checkbox is "change"... not click.
http://jsfiddle.net/rwaldron/H7qry/4/