Common DOM Properties

  • element.innerText - The text of an element. Readable or writeable
  • element.innerHTML - The HTML contents of an element
    • Can change to add / remove elements
    • This can be a bit tricky to get right
    • Great power / great responsibility
  • element.id - The id of the element. Readable or writeable
  • element.classList - Lets you see all the classes of an element
    • element.classList.add("test") - Adds a new class of "test". Powerful with CSS

5 / 17