dom-querying Flashcards
Why do we log things to the console?
for debugging purpose. and check the data.
What is a “model”?
a model is a representation of something, for dom the structure of the html page
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?
it’s made up with objects
What is a DOM Tree?
all the pieces of a DOM constructed together.
Give two examples of document methods that retrieve a single element from the DOM.
get Element Byld ()
querySe1ector ()
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?
to store the location so you can access later if needed. and don’t need to create a dom query.
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?
The browser needs to parse all of the elements in the HTML page before the JavaScript code can access them.
What does document.querySelector() take as its argument and what does it return?
it takes CSS selector, and returns
the first matching element.
What does document.querySelectorAll() take as its argument and what does it return?
it takes CSS selector, and returns a NodeList of elements that match the specified selector.