HTML DOM click() Method
HTML DOM Methods
HTML DOM click() Method
CompletedHTML DOM click() Method
HTML DOM click() Method
CompletedExample
Simulate a mouse-click when moving the mouse pointer over a checkbox:
<input type="checkbox" id="myCheck" onmouseover="myFunction()"
onclick="alert('clicked')">
<script>
// On mouse-over, execute myFunction
function myFunction() {
document.getElementById("myCheck").click();
// Click on the checkbox
}
</script>
Try it Yourself
Definition and Usage
CompletedThe click() method simulates a mouse-click on an element.
This method can be used to execute a click on an element as if the user manually clicked on it.
Browser Support
CompletedThe numbers in the table specify the first browser version that fully supports the method.
| Method | |||||
|---|---|---|---|---|---|
| click() | Yes | Yes | Yes | Yes | Yes |
Syntax
Completed
HTMLElementObject.click()
Parameters
Completed| None |
Technical Details
Completed| Return Value: | No return value |
|---|
Related Pages
CompletedHTML DOM reference: onclick event
