Get the node value of the first button element:
The result will be:
The nodeValue property sets or returns the node value of the specified node.
Note: If you want to return the text of an element, remember that text is always inside a Text node, and you will have to return the Text node's node value (element.childNodes[0].nodeValue).
Tip: An alternative to the nodeValue property can be the textContent property.
![]()
The nodeValue property is supported in all major browsers.
Set the node value:
Return the node value:
| Return Value: | A String, representing the value of the node |
|---|---|
| DOM Version | Core Level 1 |
Node Object
Your message has been sent to W3Schools.