JQuery Flashcards
What does DOM stand for?
Document Object Model
What is the DOM?
It is the browser’s representation of the current state of the HTML content of a page
What should we not confuse the DOM with?
The html file for a page
When will the DOM look a lot like an Html file?
When the browser first loads the HTML page
When will the DOM start to look different than the original HTML file?
When the JavaScript scripts start to take over.
What is one of the things that specifically start to happen when JavaScript takes over the DOM?
Html elements can be added or removed whether or not they appeared in the HTML file
When is an example of a time where you’ve worked with a DOM?
When you view HTML in the elements panel of Chrome DevTools, you are looking at a representation of the DOM.
What is traversing?
using jQuery to find particular elements in the DOM
What is manipulation in reference to the DOM?
Updating particular elements in the DOM.
So you need to use JQuery to do DOM traversing and manipulation?
No, you can accomplish that with JavaScript on it’s own
Why is it preferred to use JQuery for DOM traversing and Manipulation if you can accomplish it with normal JavaScript?
because of cross-browser compatibility issues
How do you select elements in jquery?
$(‘___’)
In the space you add the same selectors you would in css whether it be an element or a class or an Id.
Paragraphs would be —-> $(‘p’)
Class would be ——> $(‘.className’)
Etc..
If you create a class specifically for being a target of Jquery code, what prefix should you use?
.js-
Example
p class = ‘.js-rest-of-name’
Why should we use a js prefix before our JavaScript class targets ?
Because we don’t want to use the same classes for our stying classes as the ones for our JavaScript classes - styling of a page may need to change - but your page should work even if the styling changes
Do we need to add the . On the jquery class name when applying it to the HTML elements?
No, only in JavaScript
When you have a js.file that comes after JQuery where do you put the Jquery file with the script tags?
The The js file has to come after the jquery file.
What does the jquery method .find(‘ ‘) do?
It looks and searches for all the children of an element with a particular class.
What does the .parent(‘ ‘) jquery element do?
It searches for the parent of a particular element that has a certain class
what is Event Driven DOM Manipulation?
in plain English it just means writing instructions that tell the computer to listen for when specific kinds of events happen and then do something in response.
What is a CallBack Function in Jquery?
It is a set of instructions about what to do when its particular event occurs
What are the two things you need to specify when creating an event listener?
You need to specify:
- The event, its looking for
- The call back function to happen
What type of an event occurs once a page is finished loading?
a ready event
how many times does the “ready event” happen?
once per page load
What is a ‘Ready Event Call Back Function’
is a call back function that runs when the ready event occurs
A list of things i like ');
this will put a header in front of the unordered list that you have already in your HTML
content
) $('element').prepend(content
)