Learn HTML DOM
Manipulating DOM Elements
4.2
Lesson

Updating Text Inside an Element Using InnerText

We can get access to the text inside an HTML element using its innerText property.

You can see in the console, it logs the old text value. But, the text content later gets changed and is displayed in the browser with the text, “Contentment”.