Skip to content

How to change a DOM node value

New Courses Coming Soon

Join the waiting lists

Given a DOM element, how do you change its value?

Change the value of the innerText property:

element.innerText = 'x'

To lookup the element, combine it with the Selectors API:

document.querySelector('#today .total')
→ Read my DOM Tutorial on The Valley of Code
→ Read my Browser Events Tutorial on The Valley of Code
→ Read my Browser APIs Tutorials on The Valley of Code

Here is how can I help you: