dom-querying Flashcards
Why do we log things to the console?
To test our code, for debugging
What is a “model”?
Dom tree
Which “document” is being referred to in the phrase Document Object Model?
The html document
What is the word “object” referring to in the phrase Document Object Model?
a different part of the page loaded in the browser window.
What is a DOM Tree?
Model of the web page
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?
If your script needs to use the same elements more than once you can store the location of the elements in variables
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 web page needs to be loaded before you can work with it in the dom
What does document.querySelector() take as its argument and what does it return?
A css selector, This method returns only the first of the matching elements.
What does document.querySelectorAll() take as its argument and what does it return?
a Css selector and returns all of those that match that selector