Step 2: playing with the DOM
Last updated
Was this helpful?
Last updated
Was this helpful?
Before we move on making our app dynamic, we must to be sure to understand what the DOM actually is and how it works.
The Document Object Model (DOM) is a programming interface for HTML, XML and SVG documents. It provides a structured representation of the document as a tree.
document.body
returns the body of the page
document.querySelector
returns the first Element node within the document, in document order, that matches the specified selectors
element.innerHTML
represents the "rendered" text content of a node and its descendants.
More on
Try these exercises in the browser console:
Print the body of the page
Find the element with id task-list
Change the text of one element