HTML DOM activeElement Property

The HTML DOM activeElement property is a read-only property to return the currently focused element in the document.

Following is the syntax ?

document.activeElement

Let us now see an example to implement the DOM activeElement property ?

Example



Heading Two

Click in the element to get the active element.

Output

Now, click the element to display the same currently active element ?

Updated on: 2026-03-11T22:50:44+05:30

227 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements