Bug Tracker

Ticket #1360 (new bug)

Opened 1 year ago

Last modified 3 months ago

.change() on checkbox in IE

Reported by: stickmus Assigned to: anonymous
Type: bug Priority: major
Milestone: 1.2.4 Component: event
Version: 1.1.3 Keywords:
Cc: Needs: Test Case

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

1360.diff (1.2 kB) - added by brandon 10 months ago.

Change History

Changed 1 year ago by john

  • priority changed from trivial to major
  • need changed from Review to Test Case

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 10 months ago by brandon

Changed 10 months ago by brandon

  • milestone changed from 1.1.4 to 1.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.

Changed 10 months 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.

Changed 5 months ago by flesler

  • milestone changed from 1.2.2 to 1.2.4

Changed 3 months 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.

Note: See TracTickets for help on using tickets.