dome-querying Flashcards
Why do we log things to the console?
to test and to debug our code
What is a “model”?
a recreation of something
Which “document” is being referred to in the phrase Document Object Model?
HTML document
What is the word “object” referring to in the phrase Document Object Model?
the elements
What is a DOM Tree?
a recreation of the html elements on the page that can be accessed by java
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()
querySelectorAll()
Why might you want to assign the return value of a DOM query to a variable?
cache element to stop re searching multiple times
What console method allows you to inspect the properties of a DOM element object?
the dir method of the console object
Why would a tag need to be placed at the bottom of the HTML content instead of at the top?
JS needs to load after the HTML - so the DOM can load first
What does document.querySelector() take as its argument and what does it return?
an element selector and that selector
What does document.querySelectorAll() take as its argument and what does it return?
an element selector and NodeList