DOM-querying Flashcards
Why do we log things to the console?
double check our functionality, inspector our data, also our way to verify the data and values.
What is a “model”?
recreation of something used as an example, and imitate that structure or give another form.
Which “document” is being referred to in the phrase Document Object Model?
HTML document itself
What is the word “object” referring to in the phrase Document Object Model?
Elements or Tags
What is a DOM Tree?
a model of a webpage consisting of all of the elements and the nodes from the most parental node downward. HTML and all of its node that makes up HTML
Give two examples of document methods that retrieve a single element from the DOM.
- quereySelector
2. getelementById.
Give one example of a document method that retrieves multiple elements from the DOM at once.
- getelementbyClassName
- quereySelectorAll
in general try to use quereyselector and quereyselectorAll
Why might you want to assign the return value of a DOM query to a variable?
So that we can access the element node in the future.
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 browser loads the HTML before the Javascript. (browser run top to bottom).
What does document.querySelector() take as its argument and what does it return?
it takes a valid css selector string and returns an HTML element object.
What does document.querySelectorAll() take as its argument and what does it return?
it takes an CSS selectors and returns all HTML element object list (Node List).