Covers what the click action is and what happens when it is performed.
Method of dom/HTMLElementdom/HTMLElement
Syntaxvar object = object.click();
Return Value
Returns an object of type DOM NodeDOM Node
Type: HRESULT
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
ExamplesThe following example demonstrates how simulating a click using the click does not, by default, bring the element into focus.
<!DOCTYPE html>
<html>
<head>
<title>onfocus Sample</title>
<link rel="stylesheet" type="text/css" href="samplesSDKIE4.css" />
</head>
<body>
<p>DEMO: USING CLICK METHOD DOES NOT SET FOCUS<p>
<ul>
<li>Both these buttons apply the click method to the check box. </li>
<li>An alert has been set to fire when the check box is put into focus.</li>
</ul>
</p>
<input type="checkbox" id="chk1"/>
<br>
<button onclick="simclick1()">This button <strong>applies the focus method</strong> to
check box</button>
<br>
<button onclick="simclick2()">This button <strong>does not apply the focus method</strong> to check box</button>
<br>
<script>
document.getElementById("chk1").addEventListener("focus", function(){alert("check box is in focus!");}, false);
function simclick1() {
chk1.focus();
chk1.click();
}
function simclick2() {
chk1.click();
}
</script>
</body>
</html>
Notes Remarks
Note Simulating a click using the click does not bring the element being clicked into focus. (See example below).
Syntax Standards informationMicrosoft Developer Network: [Windows Internet Explorer API reference Article]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4