Bug Tracker

Opened 13 years ago

Closed 10 years ago

#1360 closed bug

.change() on checkbox in IE

Reported by: stickmus Owned by:
Priority: major Milestone: 1.2.4
Component: event Version: 1.1.3
Keywords: Cc:
Blocked by: Blocking:

Description

Using change() on a checkbox in IE has some odd trigger issues.

The event fires after you click off the box.

As a workaround use the click() function

Attachments (1)

1360.diff (1.2 KB) - added by brandon 12 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 13 years ago by john

need: ReviewTest Case
Priority: trivialmajor

This is the case with most IE form elements. I'd suspect that if we integrated a change like this, then we should do it for more input types as well (including radios and select boxes).

Changed 12 years ago by brandon

Attachment: 1360.diff added

comment:2 Changed 12 years ago by brandon

Milestone: 1.1.41.2.2

The attached patch (1360.diff) uses the new special events api to make the change event into a click event for checkboxes in IE and a focus event for radios in IE and Safari. This seems to work okay except that it will fire the change event on radios when focused even if a change in value didn't occur. However, this is better than nothing.

comment:3 Changed 12 years ago by joern

What about the lack of a change event when changing a text input using the browser's autocomplete feature? Having that fixed, too, would make the change event actually useful.

comment:4 Changed 12 years ago by flesler

Milestone: 1.2.21.2.4

comment:5 Changed 12 years ago by Andrew

One odd thing is that there are inconsistencies between a simple <SELECT> and <SELECT multiple='multiple'>, and between browsers. All tests are on XP, jQuery 1.2.6.

On the tests below, the simple <SELECT> can of course have two display states, toggled by the user: I'm using "expanded" to mean it's expanded from the drop-down (several options visible, scrollbar displayed), and "unexpanded" to mean it's displayed as a single line. The keyboard up/down keys are being used to change the SELECT value.

The Change event does gets fired in the following circumstances:

  • <SELECT multiple='multiple'> on Firefox 3, IE7, (Opera 9.5*)
  • <SELECT> unexpanded on Opera 9.5, IE7

but the Change event does not get fired on:

  • <SELECT> unexpanded on Firefox 3
  • <SELECT> expanded on Firefox 3, Opera 9.5, IE7

* NB Opera 9.5 behaves differently to the other browsers for <SELECT multiple='multiple'>, in that pressing up and down does not change the actual item selected (space must be pressed for that to occur), so no direct comparison is possible. FWIW, space triggers the change event, up/down does not; which is what I would expect.

My intuition led me to expect that change would get fired on all of those circumstances (because the visual feedback from the browser is that the selected option has changed). The one exception is in Opera 9.5 with <SELECT multiple='multiple'>; when up/down are pressed, but space is not, then the visual feedback from the browser is that the selection hasn't changed, and so I wouldn't expect the change event to fire.

comment:7 Changed 10 years ago by snover

Status: newpending

This ticket has been marked as missing a test case. In an effort to reduce the number of outstanding tickets in the bug tracker, it will be closed automatically in 30 days. In order to prevent this from happening, please provide a working test case. If a test case has already been provided and our records are wrong, please respond to the ticket so that it can be fixed. Thank you!

comment:8 Changed 10 years ago by trac-o-bot

Status: pendingclosed

Automatically closed due to 14 days of inactivity.

Note: See TracTickets for help on using tickets.