Home >Web Front-end >HTML Tutorial >What does nodeValue attribute in JavaScript HTML DOM mean?

What does nodeValue attribute in JavaScript HTML DOM mean?

WBOY
WBOYforward
2023-09-23 09:53:041472browse

JavaScript HTML DOM中的nodeValue属性是什么意思?

#The nodeValue property is used to get the node value. You need to specify the node.

Example

You can try running the following code to understand how to get the nodeValue property.

Live Demo

<!DOCTYPE html>
<html>
   <body>
      <p>Get the node value</p>
      <button>Demo Button Text</button>
      <script>
         var val = document.getElementsByTagName("BUTTON")[0];
         var res = val.childNodes[0].nodeValue;
         document.write("<br>Node Value: "+res);
      </script>
   </body>
</html>

The above is the detailed content of What does nodeValue attribute in JavaScript HTML DOM mean?. 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