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

What is the nodeName attribute in JavaScript HTML DOM?

王林
Release: 2023-09-05 22:01:10
forward
1029 people have browsed it

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>
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template