JavaScript Reference/Javascript Methods/click
"click()" Example
<html>
<body>
<script language="JavaScript">
function function1() {
myCheckbox.focus();
myCheckbox.click();
}
</script>
<input type="checkbox" id="myCheckbox" value="checkbox">
<button onclick="function1();">Click the checkbox</button>
</body>
</html>
"click()" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |<a> <address> |
| |<applet> <area> |
| |<b> <big> |
| |<blockquote> <body> |
| |<button> <caption> |
| |<center> <cite> |
| |<code> <custom> |
| |<dd> <dfn> |
| |<dir> <div> |
| |<dl> <dt> |
| |<em> <embed> |
| |<fieldset> <font> |
| |<form> <hn> |
| |<hr> <i> |
| |<img> <input type="button"> |
| |<input type="checkbox"> <input type="file"> |
| |<input type="image"> <input type="password"> |
| |<input type="radio"> <input type="reset"> |
| |<input type="submit"> <input type="text"> |
| |<kbd> <label> |
| |<legend> <li> |
| |<listing> <map> |
| |<marquee> <menu> |
| |<nobr> <object> |
| |<ol> <option> |
| |<p> <plaintext> |
| |<pre> <s> |
| |<samp> <select> |
| |<small> <span> |
| |<strike> <strong> |
| |<sub> <sup> |
| |<table> <tbody> |
| |<td> <textarea> |
| |<tfoot> <th> |
| |<thead> <tr> |
| |<tt> <u> |
| |<ul> <var> |
| |<xmp> |
+----------------+--------------------------------------------------------------+
"click()" Syntax, Parameters and Note
Note:
Simulate the clicking, triggering the onClick event.
Syntax:
document.getElementById("elementID").click()
document.all.elementID.click() // IE only