0% found this document useful (0 votes)
67 views4 pages

Htmlelement - Click : Syntax

The HTMLElement.click() method simulates a mouse click on an element. When used on supported elements like <input>, it fires the element's click event which then bubbles up to higher elements in the DOM tree, firing their click events as well. The click() method takes no arguments and simulates a mouse click by firing the element's click event.

Uploaded by

Assalam Azeem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views4 pages

Htmlelement - Click : Syntax

The HTMLElement.click() method simulates a mouse click on an element. When used on supported elements like <input>, it fires the element's click event which then bubbles up to higher elements in the DOM tree, firing their click events as well. The click() method takes no arguments and simulates a mouse click by firing the element's click event.

Uploaded by

Assalam Azeem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Technologies

References & Guides

Feedback

Sign in

Search

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()

Example
Simulate a mouse-click when moving the mouse pointer over a checkbox:
HTML

1 <form>
2 <input type="checkbox" id="myCheck" onmouseover=
3 </form>

JavaScript

1 // On mouse-over, execute myFunction


2 function myFunction() {
3 document.getElementById("myCheck").click();
4 }

Specification
Specification Status Comment

Document Object Model (DOM) Level 2 Initial


Obsolete
HTML Specification definition.

Browser compatibility
Update compatibility data on GitHub

click

Chrome 9

Edge 12
Firefox 3

IE Yes

Opera Yes

Safari 6

WebView Android Yes

Chrome Android 18

Firefox Android 5

Opera Android Yes

Safari iOS Yes

Samsung Internet Android ?

Full support

Compatibility unknown

See implementation notes.

See also
Related event handlers
GlobalEventHandlers.onclick
GlobalEventHandlers.ondblclick
GlobalEventHandlers.onauxclick

You might also like