DOM Querying Flashcards
Why do we log things to the console?
To double check things are what we meant them to be
What is a “model”?
the order in which a page is loaded. A recreation of the HTML.
Which “document” is being referred to in the phrase Document Object Model?
The webpage
What is the word “object” referring to in the phrase Document Object Model?
separated parts in the HTML.
What is a DOM Tree?
a model of the HTML page created and stored in the browser’s memory
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.
getElementsByClassName();
Why might you want to assign the return value of a DOM query to a variable?
so you can call upon/edit/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?
So that the script can run after all the information has been input
What does document.querySelector() take as its argument and what does it return?
It takes the css selector and returns the content of the fist associated element
What does document.querySelectorAll() take as its argument and what does it return?
it takes the css selector and returns the content of all the associated elements