HomeTutorsContact
JavaScript
How To Set Node Value In Javascript?
Gulshan Saini
May 24, 2020
1 min

The nodeValue property sets or gets the node value of the specified node. The value returned by DOM API, depends on the type of the node.

Setting node value

Let’s start with the following markup

To set the node value of h1 tag first we need to select the elements TEXT_NODE as follows

Next, we can use property nodeValue to set the contents if previously captured TEXT_NODE

Output

Setting node value using javascript
Setting node value using javascript

Here is, complete code


Tags

#dom-manipulation
Previous Article
How To Get Node Value In Javascript?

Subscribe to our newsletter!

We'll send you the best of our blog just once a month. We promise.

Related Posts

How to iterate through NodeList using Javascript?
July 09, 2020
1 min
© 2020, All Rights Reserved.

Quick Links

Advertise with usContact Us

Social Media