The click event fires when the user clicks on an element OR activates an element by other means (i.e. the keyboard). It is the most important JavaScript event. The other events on this page are strictly subsidiary.
“click” event is really a misnomer: it should be called the “activate” event. (And the Microsoft activate event is in fact not a click event but a focus event. You’re still with me?)
Don't register click and dblclick events on the same element: it's impossible to distinguish single-click events from click events that lead to a dblclick event.
Test | IE 5.5 | IE 6 | IE 7 | IE8 | IE9 | IE10 pr2 | FF 7.0 Win | FF 6.1 Mac | Saf 5.1 Win | Saf 5.1 Mac | Chrome 14 Win | Chrome 13 Mac | Opera 11.51 Win | Opera 11.51 Mac |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
On the window
|
No | Yes | Yes | Yes | Yes | Yes | ||||||||
Are these events available on the window?
|
||||||||||||||
On the document
|
Yes | Yes | Yes | Yes | Yes | |||||||||
Are these events available on the document? |
||||||||||||||
On form fields and links
|
Yes | Yes | Yes | Yes | Yes | |||||||||
Are these events available on form fields and links?
|
||||||||||||||
On labels
A mousedown, mouseup and click event fire on the label, and then a click event fires on the related form field. |
Yes | Yes | Yes | Yes | Yes | |||||||||
On any element
|
Yes | Yes | Yes | Yes | Yes | |||||||||
Are these events available on any element? |
||||||||||||||
Click as activate
|
Yes | Yes | Yes | Yes | Yes | |||||||||
A click event should also fire when the user activates an element (such as a link, checkbox or button) through the keyboard. IE, Firefox and Opera allows users to check radios in the same group by using the arrow keys and the space bar once they've tabbed to one of the radios. In that case the click event fires, too. |
||||||||||||||
Test | IE 5.5 | IE 6 | IE 7 | IE8 | IE9 | IE10 pr2 | FF 7.0 Win | FF 6.1 Mac | Saf 5.1 Win | Saf 5.1 Mac | Chrome 14 Win | Chrome 13 Mac | Opera 11.51 Win | Opera 11.51 Mac |
dblclick
|
Yes | Yes | Yes | Yes | Yes | |||||||||
Is the dblclick event supported? |
||||||||||||||
Events leading to dblclick
|
Incom |
Yes | Yes | Yes | Yes | Yes | ||||||||
IE 5-8 use the following event order:
|
||||||||||||||
Bubbling
|
Yes | Yes | Yes | Yes | Yes | |||||||||
These events should bubble up. |
||||||||||||||
Cancel bubble
|
Yes | Yes | Yes | Yes | Yes | |||||||||
These events should bubble up. |
||||||||||||||
Prevent default
|
Incom |
Almost | Incom |
Yes | Almost | Incom |
||||||||
All click default actions should be cancelable. That's one of the points of this important event.
|
||||||||||||||
Test | IE 5.5 | IE 6 | IE 7 | IE8 | IE9 | IE10 pr2 | FF 7.0 Win | FF 6.1 Mac | Saf 5.1 Win | Saf 5.1 Mac | Chrome 14 Win | Chrome 13 Mac | Opera 11.51 Win | Opera 11.51 Mac |