- How do you select HTML elements using element names, ID, or class? The syntax looks like this
$("[Class or Tag here]").[Property Here]("[Altered Value Here]");
- What are the different ways to chain selectors? For instance, how would you select an element that has a class of “bordered-content” AND “ad-aside”? I think the syntax would look something like
$("bordered-content, ad-aside");
This would allow you to select multiple HTML elements with one jquery selector
-
How can you select many elements with different classes and IDs in a single selector statement? For instance, how can you select an element with the ID of “main” and a different element with an ID of “secondary”? I imagine it would be the same as above, just use commas in your JQuery selector to grab multiple elements in one go
-
How do you select based on element attributes?
$("[attribute=value]");
Will allow you to grab ALL elements that have that attribute and value/
- How do you select based on the state of a checkbox or radio button? From what I've found online, there is a JQuery method called .prop(), so the syntax would look a little something like this
$("#x").prop("checked", true);
$("#x").prop("checked", false);
This would allow you to select it based off whether the checked property was true or flase.
-
What does the jQuery selector return? Be specific. It returns a JQuery Object, or rather, an element wrapped in a JQuery Object, which is not an array, and entirely different from a Javascript Object.
-
Create a demo (in CodePen) explaining the use of different kinds of selectors. My failed attempt https://codepen.io/rahughes/pen/aboJXBZ
-
Where do you go to find the official jQuery docs? https://api.jquery.com/