nodeValue property
The nodeValue property allows
you to find out the value of a node
or set it in HTML code.
Syntax
node.nodeValue;
Example
Let's display the text of an element
using the nodeValue property:
<p id="elem">text</p>
let elem = document.querySelector('#elem');
let value = elem.nodeValue;
console.log(value);
The code execution result:
'text'
See also
-
the
textContentproperty
that contains an element text -
the
innerHTMLproperty
that contains an HTML code of an element