X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML DOM nodeValue Property

Element Object Reference Element Object

Example

Get the node value of the first button element:

document.getElementsByTagName("BUTTON")[0].childNodes[0].nodeValue;

The result will be:

Try it yourself

Try it yourself »


Definition and Usage

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.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The nodeValue property is supported in all major browsers.


Syntax

Set the node value:

node.nodeValue=value

Return the node value:

node.nodeValue

Technical Details

Return Value: A String, representing the value of the node
DOM Version Core Level 1 Node Object


Element Object Reference Element Object


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook