HTML DOM hasFocus() Method
Clash Royale CLAN TAG#URR8PPP
<!--
main_leaderboard, all: [728,90][970,90][320,50][468,60]-->
HTML DOM hasFocus() Method
❮ Document Object
Example
Output some text if the document has focus:
var x = document.getElementById("demo");
if (document.hasFocus())
x.innerHTML = "The document has focus.";
else
x.innerHTML = "The document DOES NOT have focus.";
Try it Yourself »
Definition and Usage
The hasFocus() method returns a Boolean value indicating whether the document
(or any element inside the document) has focus.
Browser Support
The numbers in the table specify the first browser version that fully supports the method.
Method | |||||
---|---|---|---|---|---|
hasFocus() | 30.0 | 6.0 | 3.0 | Yes | 23.0 |
Syntax
document.hasFocus()
Parameters
None |
Technical Details
Return Value: | A Boolean value, incidating whether the document or any element in the document has focus:
|
---|
❮ Document Object