Simulate a mouse-click when moving the mouse pointer over a checkbox:
<input type="checkbox" id="myCheck" onmouseover="myFunction()";
<script>
function myFunction() {
document.getElementById("myCheck").click();
}
</script>
Try it Yourself »
The 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.
HTML DOM reference: onclick event
element.click()
NONE |
NONE |
element.click()
is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!