Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

What is nodeName Property in JavaScript HTML DOM



The nodeName property in JavaScript is used to specify the name of a node.

Example

You can try to run the following code to learn how to implement a nodeName property in JavaScript.

Live Demo

<!DOCTYPE html>
<html>
   <body>
      <h1 id="id1">Tutorials</h1>
      <p id="id2">Demo Content</p>
      <p id="id3"></p>
      <p id="id4"></p>
      <script>
         document.getElementById("id3").innerHTML = document.getElementById("id1").nodeName;
         document.getElementById("id4").innerHTML = document.getElementById("id2").nodeName;
      </script>
   </body>
</html>
Updated on: 2020-05-22T11:15:12+05:30

177 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements