HTML | DOM click() Method
The click() method is used to simulate the mouse click on an element. This method works exactly the same as the element is manually clicked.
Syntax:
HTMLElementObject.click()
Parameters: No parameters required.
Return Value: No return value.
Example: In this example, when the cursor goes over the radio button, it’ll execute the mouse click event and the radio button is checked as it is clicked manually.
<!DOCTYPE html> <html> <head> <title> HTML | DOM click() method </title> <!--script to stimulate mouse click--> <script> function clck() { document.getElementById("input1").click(); } </script> </head> <body> <p> Hover over the radio button to simulate a mouse-click. </p> <form> <input type="radio" id="input1" onmouseover="clck()"> GeeksforGeeks </form> </body> </html> |
Output:
Before hovering on the radio button:

After hovering on the radio button:

Supported Browsers: The browser supported by DOM click() Method are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari
Recommended Posts:
- How to add many functions in one ng-click directive?
- AngularJS | ng-click Directive
- How to simulate a click with JavaScript ?
- What is the use of a double-click event in AngularJs?
- How to remove active nav-tab when click outside of nav-tab in Bootstrap ?
- How to disable right click on web page using JavaScript ?
- How to remove focus around buttons on click?
- How to distinguish left and right mouse click using jQuery?
- How to perform click-and-hold operation inside an element using jQuery ?
- How to load notification alert on top right corner without click of button in bootstrap ?
- HTML | DOM contains() Method
- HTML | DOM appendChild() Method
- HTML | DOM removeAttribute() Method
- HTML | DOM getBoundingClientRect() Method
- HTML | DOM fullscreenEnabled() Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



