Chapter 2. Selecting Elements
This chapter demonstrates how to select elements by using jQuery. It covers CSS selectors, extensions, and functions to further find and filter elements. After selecting elements, you can use additional methods to traverse the document.
Recipe: Combining Two Element Sets by Using add()
Using the standard jQuery selector, you can make a single CSS query. However, in some cases, you might want to perform an operation on a set of elements beyond a single CSS query. When using the
add()function, additional selectors can be added. This creates additional selections instead of only modifying the original selector. Listing 2.1 shows how you can combine the results of two CSS queries for use with a single operation.