Skip to content
FLAVIO COPES
flaviocopes.com
2026

How to change a DOM node value

By Flavio Copes

Learn how to change a DOM node value by setting its innerText property, and how to grab the element first with the Selectors API document.querySelector method.

~~~

Change the value of the innerText property:

element.innerText = 'x'

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

document.querySelector('#today .total')
~~~

Related posts about platform: