W3cubDocs

/DOM

HTMLElement.click

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

When click() is used with supported elements (such as an <input>), it fires the element's click event. This event then bubbles up to elements higher in the document tree (or event chain) and fires their click events.

Syntax

element.click()

Specification

Specification Status Comment
Document Object Model (DOM) Level 2 HTML Specification Obsolete Initial definition.

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support 9
9
Before Chrome 19, click is only defined on buttons and inputs.
Yes 3
3
Before Firefox 5, click is only defined on buttons and inputs, and has no effect on text and file inputs.
Yes Yes Yes
Yes
Before Safari 6, click is only defined on buttons and inputs.
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support Yes
Yes
Before Android WebView 4.4, click is only defined on buttons and inputs.
Yes Yes 5 Yes Yes
Yes
Before Safari 6, click is only defined on buttons and inputs.
?

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click