Javascript examples for DOM:Element click
The click() method simulates a mouse-click on an element.
None
No return value
The following code shows how to Simulate a mouse-click when moving the mouse pointer over a checkbox:
<!DOCTYPE html> <html> <body> <p>Hover over the checkbox to simulate a mouse-click.</p> <form> <input type="checkbox" id="myCheck" onmouseover="myFunction()" onclick="console.log('click event occured')"> </form>//ww w.j a va 2s .c om <script> function myFunction() { document.getElementById("myCheck").click(); } </script> </body> </html>