HTML DOM tagName Property

The DOM tagName Property is used to return the tagname of the Element. It is read-only property and used to display the returned value of tagName in UPPERCASE letters.

Syntax:

element.tagName 

Return Value: It returns a string value which represent the tagName of the element in UPPERCASE letters.

Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <style>
        h1 {
            color: green;
            font-size: 35px;
        }
    </style>
</head>
  
<body>
    <center>
        <h1>GeeksForGeeks</h1>
        <h2 id="GFG">DOM tagName Property</p>
  
<button onclick="Geeks()">Submit</button>
  
<p id="sudo"></p>
  
<script>
function Geeks() {
  var w = document.getElementById("GFG").tagName;
  document.getElementById("sudo").innerHTML = w;
}
</script>
  
</body>
</html>

chevron_right


Output:
Before clicking on the button:

After clicking on the button:

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

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


1


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.