Skip to content
Related Articles

Related Articles

Improve Article

HTML | DOM activeElement Property

  • Difficulty Level : Basic
  • Last Updated : 24 Jul, 2019

The DOM activeElement property is used to return the currently active elements in the HTML document. This property is read-only. It gives the reference of a focused element object in the document.




<!DOCTYPE html>
            h1 {
            body {
            function GFG() {
                // Get Active Element using activeElement
                // property and assign it value equal to 
                // to its tag
                var x = document.activeElement.tagName;
                document.getElementById("geeks").innerHTML = x;
    <body onclick="GFG()">
        <h2>DOM activeElement property</h2>
        <input type="text" placeholder="GeeksforGeeks">
        <p id="geeks"></p>


Supported Browsers: The browser supported by DOM activeElement property are listed below:

  • Google Chrome 2.0
  • Internet Explorer 4.0
  • Firefox 3.0
  • Opera 9.6
  • Safari 4.0

Attention reader! Don’t stop learning now. Get hold of all the important Comcompetitivepetitve Programming concepts with the Web Design for Beginners | HTML  course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :