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.
| 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 | Incom |
||||||
|
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 | Almost | Yes | Almost | ||||||
|
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 | Incor |
Too many | ||||||
|
|||||||||||
|
On any element
|
Yes | Yes | Yes | Yes | Yes | ||||||
|
Are these events available on any element? |
|||||||||||
|
Click as activate
|
Yes | Yes | Yes | Almost | Yes | Too many | |||||
|
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, except in Opera 9.26.
|
|||||||||||
| 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 |
|
dblclick
|
Yes | Yes | Yes | Yes | No | ||||||
|
Is the dblclick event supported? |
|||||||||||
|
Events leading to dblclick
|
Incom |
Yes | Yes | Yes | Untest |
||||||
|
IE uses the following event order:
|
|||||||||||
|
Bubbling
|
Yes | Yes | Yes | Almost | Almost | ||||||
|
These events should bubble up.
|
|||||||||||
|
Cancel bubble
|
Yes | Yes | Yes | Yes | Yes | ||||||
|
These events should bubble up.
|
|||||||||||
|
Prevent default
|
Almost | Almost | Almost | Yes | Almost | ||||||
|
All click default actions should be cancelable. That's one of the points of this important event.
|
|||||||||||
| 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
|
DOMActivate
Should fire when an element is activated. |
No | Yes | Incor |
No | Incor |
||||||
|
A link is activated when the user follows it. A checkbox or radio is activated when it is checked or unchecked.
|
|||||||||||
| 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 |