HTML DOM nodeName Property

The nodeName property returns the name of the specified node. For example if the node is an element node, then the nodeName will returns the tag name and if the node is an attribute node, then it returns the name of attribute. The syntax of nodeName is as follows :
Example :
  <p id="demo" class="paragraph" style="color: blue;">Hello world</p>
  <p>The NodeName is : <b><span id="echo"></span></b></p>
    var name = document.getElementById("demo").nodeName;
    document.getElementById("echo").innerHTML = name;
Output :

Hello world
The NodeName is :

Next Topic :