Skip to content
Related Articles

Related Articles

HTML | DOM click() Method

Improve Article
Save Article
Like Article
  • Last Updated : 17 Aug, 2021

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. 
 

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML | DOM click() method
    </title>
    <!--script to stimulate mouse click-->
    <script>
        function click() {
            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="click()">
      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

 

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!