Dom Querying Flashcards
Why do we log things to the console?
to debug and test our code
Why do we log things to the console?
to debug and test our code
What is a “model”?
A recreation (or model) of something
Which “document” is being referred to in the phrase Document Object Model?
the html page
What is the word “object” referring to in the phrase Document Object Model?
objects within the Dom tree- representing a different part of the html page
What is a DOM Tree?
A model of the html page
Give two examples of document methods that retrieve a single element from the DOM.
getElementByld()
querySelector()
Give one example of a document method that retrieves multiple elements from the DOM at once.
getElementsByClassName()
querySelectorAll()
Why might you want to assign the return value of a DOM query to a variable?
so it holds it’s reference place
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 the JS loads after the html
What does document.querySelector() take as its argument and what does it return?
returns the first element node that matches the CSS-style selector.
Both methods take a CSS selector as their only parameter.
What does document.querySelectorAll() take as its argument and what does it return?
returns a Nodelist of all of the matches.
Both methods take a CSS selector as their only parameter.
What is a “model”?
A recreation (or model) of something
Which “document” is being referred to in the phrase Document Object Model?
the html page