« Element

The HTMLElement.click() method simulates a mouse click on an element.

When click is used with elements that support it (e.g. one of the <input> types listed above), it also fires the element's click event which will bubble up to elements higher up the document tree (or event chain) and fire their click events too. However, bubbling of a click event will not cause an <a> element to initiate navigation as if a real mouse-click had been received.

By the time of this writing (Opera Next is in version 12.11), Opera's click() method will silentely be ignored if made on an <input> with its "type" attribute set to "file" and its CSS display property set to "none".

Note: Prior to Gecko 5.0, Gecko didn't implement the click method on other elements that might be expected to respond to mouse–clicks such as links (<a> elements), nor will it necessarily fire the click event of other elements. However, now it is supported by all elements, as required by HTML5.

Non–Gecko DOMs may behave differently.




Specification Status Comment
Document Object Model (DOM) Level 2 HTML Specification Recommendation  

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Minimum support (Yes) 5 (Yes) (Yes) (Yes)
input@file (limited) (Yes) 4 (Yes) 12.10 (Yes)
input@file (full) (Yes) 4 (Yes) Not supported (Yes)
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support ? ? ? ? ? ?

Note: Basic support here, is to support just the barely minimum that the specification forces the browser to support.


Document Tags and Contributors

Contributors to this page: teoli
Last updated by: teoli,