HTML DOM Document activeElement property
- Previous Page all[]
- Next Page addEventListener()
- Go to the Previous Level HTML DOM Documents
Definition and usage
activeElement
The property returns the HTML element that has received focus.
activeElement
The property is read-only.
See also:
Example
Get the currently focused element:
const element = document.activeElement.tagName;
Syntax
document.activeElement
Return value
Type | Description |
---|---|
Element | The HTML element that has received focus. |
Browser support
document.activeElement
It is a DOM Level 1 (1998) feature.
All browsers fully support it:
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Chrome | IE | Edge | Firefox | Safari | Opera |
Support | 9-11 | Support | Support | Support | Support |
- Previous Page all[]
- Next Page addEventListener()
- Go to the Previous Level HTML DOM Documents