DOM Flashcards
Why do we log things to the console?
to check the result of element
What is a “model”?
representation of an actual thing
Which “document” is being referred to in the phrase Document Object Model?
HTML
What is the word “object” referring to in the phrase Document Object Model?
JavaScript
What is a DOM Tree?
tree data structure of HTML page
Give two examples of document methods that retrieve a single element from the DOM.
queryselector & getElementById
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?
to reuse the result again
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 dom element gets loaded before javascript try to get elements
What does document.querySelector() take as its argument and what does it return?
selector element and result first match
What does document.querySelectorAll() take as its argument and what does it return?
selector element and result is all-match
Why do we log things to the console?
to debugging
What is the purpose of events and event handling?
to perform some action base on user action
Are all possible parameters required to use a JavaScript method or function?
No
What method of element objects lets you set up a function to be called when a specific type of event occurs?
addEventListener
What is the className property of element objects?
its use to get and update class name of element