Mindblown: a blog about philosophy.
-
Conclusion
This lesson focused on creating and adjusting sets of elements (referred to in this lesson and beyond as a jQuery collection or set of matched elements) via the many means that jQuery provides for identifying elements on an HTML page. jQuery provides a versatile and powerful set of selectors, patterned after the selectors of CSS, for identifying elements…
-
Testing your skills with some exercises
In this section you’ll practice doing some exercises targeting the selectors and the filters described in this lesson. If you want to test your solutions, you can run them using the jQuery Selectors Lab Page. In addition, we’ll provide you our solutions to allow you to compare them with yours. Exercises Here’s the list of…
-
Enhancing performances using context
Up to this point, we’ve been acting as if there were only one argument that we can pass to jQuery’s $() function, but this was just a bit of hand waving to keep things simple at the start. In lesson 1 we briefly introduced a second parameter called context. It’s used to restrict the selection to one or more subtrees…
-
Introducing filters
Filters are selectors that usually work with other types of selectors to reduce a set of matched elements. You can recognize them easily because they always start with a colon (:). Just as you’ve seen for the attributes, if another selector isn’t specified, the use of the Universal selector is implicitly assumed. One of the peculiarities…
-
Selecting elements using attributes
Attribute selectors are extremely powerful and allow you to select elements based on their attributes. You can easily recognize these selectors because they’re wrapped with square brackets (for example, [selector]). To see them in action, let’s take another look at a portion of the lab page: What usually makes the link pointing to an external site unique…
-
Retrieving elements by their hierarchy
Retrieving a set of elements by their class name is a nice feature, but often you don’t want to search the whole page. Sometimes you may want to select only the direct children of a certain element. Consider the following HTML fragment from the sample DOM in the Selectors Lab: Suppose that you wanted to…
-
Basic selectors
For applying styles to page elements, web developers have become familiar with a small but useful group of selection expressions that work across all browsers. Those expressions can select by an element’s ID, by CSS class names, and by tag names. A special case of selecting elements by tag name is the Universal selector, which…
Got any book recommendations?