1. Home
  2. Javascript
  3. Inner text

Inner text lets you get and set the text of selected element.

#javascript
// Get the inner text value of the selected element and assign it to a variable
var el = document.getElementById("element").innerText;

// Set the inner text value
document.getElementById("another-element").innerText = "New text";
copy
Full Javascript cheatsheet