Dom-querying Flashcards
Why do we log things to the console?
Easier to Debug
What is a “model”?
The DOM tree
Which “document” is being referred to in the phrase Document Object Model?
Represents the entire page
What is the word “object” referring to in the phrase Document Object Model?
Each node, which is an object
What is a DOM Tree?
The model of the web page
Give two examples of document methods that retrieve a single element from the DOM.
getElementByID, querySelector
Give one example of a document method that retrieves multiple elements from the DOM at once.
getElementByClassName
Why might you want to assign the return value of a DOM query to a variable?
when needing to work with an element more than once
What console method allows you to inspect the properties of a DOM element object?
.dir()
Why would a tag need to be placed at the bottom of the HTML content instead of at the top?
so the HTML can load before any JS changes
What does document.querySelector() take as its argument and what does it return?
takes in a CSS selector and returns element that matches with it
What does document.querySelectorAll() take as its argument and what does it return?
Takes a css selector that matches all elements with selector and returns a node list