What is nodeValue property in JavaScript HTML DOM?

HTMLJavascriptProgramming Scripts

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


You can try to run the following code to learn how to get nodeValue property.

Live Demo

<!DOCTYPE html>
      <p>Get the node value</p>
      <button>Demo Button Text</button>
         var val = document.getElementsByTagName("BUTTON")[0];
         var res = val.childNodes[0].nodeValue;
         document.write("<br>Node Value: "+res);
Updated on 22-May-2020 11:15:51