HTML / CSS / JavaScript Tutorial

JavaScript Document method: hasFocus()

[this page | pdf | back links]

The hasFocus() method (when applied to the document object of the JavaScript DOM) returns true if document has focus, otherwise returns false.


It has the following syntax with no parameters. It returns a Boolean value indicating whether the document (or any element within it) has focus (loosely speaking where the cursor currently is).




Contents | Prev | Next | JavaScript DOM (and BOM)

Desktop view | Switch to Mobile