1. Home
  2. Javascript
  3. Inner html
#javascript

Inner HTML lets you get and set the content of selected element.

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

// Set the inner HTML value
document.getElementById("another-element").innerHTML = "New content added";
copy
Full Javascript cheatsheet
Sitemap Git repository