Working with Elements

Working with Elements: Working with Elements: an overview, Common DOM Interactions, Manipulating the DOM Structure.

Updated

  1. Working with Elements: an overview (Apprentice): Once you've found an element, JavaScript can read it and change it, from its text and CSS classes to which elements are on the page at all.
  2. Common DOM Interactions (Apprentice): Once you have an element, you change its text with textContent, its HTML with innerHTML, its look with style, and its CSS classes with classList.
  3. Manipulating the DOM Structure (Apprentice): createElement makes a new element, appendChild puts it inside a parent so it shows on the page, and remove takes an element off the page.