1. Home
  2. Javascript
  3. Inner text

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

// 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";
Full Javascript cheatsheet
Sitemap Git repository