HTML DOM Document activeElement property
- Vorherige Seite all[]
- Nächste Seite addEventListener()
- Zurück zur übergeordneten Ebene 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 |
Unterstützung | 9-11 | Unterstützung | Unterstützung | Unterstützung | Unterstützung |
- Vorherige Seite all[]
- Nächste Seite addEventListener()
- Zurück zur übergeordneten Ebene HTML DOM Documents