Tutorials  "/> Tutorials  ">

Home  >  Article  >  Web Front-end  >  What is the nodeName attribute in JavaScript HTML DOM?

What is the nodeName attribute in JavaScript HTML DOM?

王林
王林forward
2023-09-05 22:01:10954browse

JavaScript HTML DOM中的nodeName属性是什么?

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

Example

You can try running the following code to understand how to implement the nodeName property in JavaScript.

Real-time demonstration

<!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>

The above is the detailed content of What is the nodeName attribute in JavaScript HTML DOM?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete