LearningFuze Mod 1 - Dom Query Flashcards
Why do we log things to the console?
To check and debug our code
What is a “model”?
Its showing an example of something
Which “document” is being referred to in the phrase Document Object Model?
Document Node
What is the word “object” referring to in the phrase Document Object Model?
A collection of objects in javascript
What is a DOM Tree?
It represents html objects in the nodes
Give two examples of document methods that retrieve a single element from the DOM.
Documents query selector, and get element by ID
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?
When you need to work with an element more than once, you should use a variable for that query, it also saves time
What console method allows you to inspect the properties of a DOM element object?
the dir method
Why would a tag need to be placed at the bottom of the HTML content instead of at the top?
The HTML must be read before the script, or the webpage will read the script first
What does document.querySelector() take as its argument and what does it return?
It takes a CSS selector but instead of a string it returns the HTML element and what it’s holding
What does document.querySelectorAll() take as its argument and what does it return?
it takes any CSS selector and it returns a static Node list
Why do we log things to the console?
To check and debug our code
What is the purpose of events and event handling?
An event indicates an action taking place, and the event handle deals with the event
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?
the addEventListener method