Easy Tutorial
❮ Event Onshow Prop Tabledata Abbr ❯

HTML DOM nodeValue Property

Element Object

Example

Retrieve the node value of the first button element:

Output result:


Definition and Usage

The nodeValue property sets or returns the value of a node, depending on the type of the node.

Note: If you want to return the text of an element, remember that text is usually inserted into a text node, so the return value is the node value of the text node (element.childNodes[0].nodeValue).

Tip: Another property to get the node value is the textContent Property.


Browser Support

All major browsers support the nodeValue property.


Syntax

Set node value:

Return node value:

Technical Details

Return Value: A string of the node value.
DOM Version Core Level 1 Node Object
--- ---

Element Object

❮ Event Onshow Prop Tabledata Abbr ❯