DOM query Flashcards
Why do we log things to the console?
method for developers to write code to inconspicuously inform the developers what the code is doing
What is a “model”?
data structures that we use to define the shape of our data(blueprint)
Which “document” is being referred to in the phrase Document Object Model?
It defines the logical structure of documents and the way a document is accessed and manipulated (document node)
What is the word “object” referring to in the phrase Document Object Model?
The DOM represents the document as nodes and objects; that way, programming languages can interact with the page
What is a DOM Tree?
it is a model of a page that stores data of the browser of our html
Give two examples of document methods that retrieve a single element from the DOM.
querySelector(), getElementsBy()
Give one example of a document method that retrieves multiple elements from the DOM at once.
document.querySelectorAll
Why might you want to assign the return value of a DOM query to a variable?
allows you to move the DOM object around more easily and cleanly
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?
give html time to load before the JavaScript to prevent any errors
What does document.querySelector() take as its argument and what does it return?
the first Element within the document that matches the specified selector, or group of selectors
What does document.querySelectorAll() take as its argument and what does it return?
all of the Elements within the document that matches the specified selector, or group of selectors