YouTip LogoYouTip

Prop Document Activeelement

# HTML DOM activeElement Property [![Image 3: Document Object Reference Manual](#) Document Object](#) ## Example The currently focused element: var x = document.activeElement.tagName; The output of _x_ is: BUTTON [Try it Β»](#) * * * ## Definition and Usage The activeElement property returns the currently focused element in the document. **Note:** This property is read-only. **Tip:** To set focus on an element, use the [_element_.focus()](#) method. **Tip:** You can use the [document.hasFocus()](#) method to check if the current element has focus. * * * ## Browser Support The numbers in the table specify the first browser version that fully supports the property. | Property | | | | | | | --- | --- | --- | --- | --- | --- | | activeElement | 2.0 | 4.0 | 3.0 | 4.0 | 9.6 | * * * ## Syntax document.activeElement ## Technical Details | Return Value: | The currently focused element | | --- | * * Document Object](#)
← Thread SuspendThread Procon β†’