dom querying Flashcards
Why do we log things to the console?
To observe things
What is a “model”?
A representation
Which “document” is being referred to in the phrase Document Object Model?
HTML Page
What is the word “object” referring to in the phrase Document Object Model?
The document is made up of many objects
What is a DOM Tree?
Hierarchy of the objects that make up the HTML Document
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.
querySelectorAll()
Why might you want to assign the return value of a DOM query to a variable?
So that you can use it later
What console method allows you to inspect the properties of a DOM element object?
console.dir()
Why would a tag need to be placed at the bottom of the HTML content instead of at the top?
Because the page element needs to be executed before DOM can access it
What does document.querySelector() take as its argument and what does it return?
returns the object of the element
What does document.querySelectorAll() take as its argument and what does it return?
It takes the selector as a string and returns a node list