change

Test page.

Events overview page.

The change event fires when a form field changes state.

change on text inputs
Fires when the user blurs the input AND the text has been changed since the last focus.
change on select boxes
Fires when the user activates a new option (either by a mouse click or by a keyboard activation).
change on checkboxes and radios
Fires when the user changes the element’s state (checked or not).
Event IE 5.5 IE 6 IE 7 IE8b1 FF 2 FF 3b5 Saf 3.0 Win Saf 3.1 Win Opera 9.26 Opera 9.5b Konqueror 3.5.7
On the window
No Yes Yes Minimal Yes

Is this event available on the window?

  • Opera allows registration on the window only when you use attachEvent.
On the document
No Yes Yes Yes Yes

Is this event available on the document?

On a form
No Yes Yes Yes Yes

Is this event available on a form?

On text inputs

The event should fire when the text input is blurred AND its contents have changed since the user focused on it.

Yes Yes Yes Yes Yes
Event IE 5.5 IE 6 IE 7 IE8b1 FF 2 FF 3b5 Saf 3.0 Win Saf 3.1 Win Opera 9.26 Opera 9.5b Konqueror 3.5.7
On checkboxes and radios

The event should fire when the checkbox or radio is activated AND its checked property changes.

Buggy Yes Yes Too many Yes Yes

(The check property always changes when you click on a checkbox, but a click on a checked radio should not fire this event.)

  • IE fires the event when the checkbox or radio is blurred, and not when it is activated. This is a serious bug that requires the user to take another action and prevents a consistent cross-browser interface based on the change event on checkboxes and radios.
  • Opera 9.26 fires the event twice on radio buttons.
On select boxes

The event should fire when the user has selected a new option.

Yes Yes Yes Yes Yes

When the user uses a mouse the click on the new option fires the event; when he uses a keyboard the event is fired when the select box is blurred.

On reset

When the user resets the entire form the event should fire on every element that changes.

No No No No Minimal

Browsers generally disagree with my beautiful theory.

  • When you reset a form, Konqueror fires the change event on checkboxes only.
Event bubbling

The event should bubble.

Untestable Yes Yes Almost Almost
  • When using attachEvent registration, Opera fires the event on the window before the event on the document. (The event isn’t available on the window in any other registration.)
  • When using addEventListener in the capturing phase, Konqueror fires the event on the window last instead of first.
Prevent default
“No” is the correct answer
Buggy No No No No No

The default action cannot be prevented.

  • When you try to prevent the default action in IE5/6 the focus gets stuck. In combination with the checkbox/radio bug this can cause weird results that end users will be unable to appreciate.
    The browser doesn't actually prevent the default.
Event IE 5.5 IE 6 IE 7 IE8b1 FF 2 FF 3b5 Saf 3.0 Win Saf 3.1 Win Opera 9.26 Opera 9.5b Konqueror 3.5.7