Chapter 2. Selecting elements

 

This chapter covers

  • Selecting elements with jQuery by using CSS selectors
  • Discovering the unique jQuery-only filters
  • Developing custom filters
  • Learning the context parameter of the jQuery() function

In this chapter, we’ll examine in great detail how the DOM elements to be acted upon are identified by looking at one of the most powerful and frequently used capabilities of jQuery’s $() function: the selection of DOM elements via selectors. Throughout the pages of this chapter, you’ll become familiar with the plethora of selectors available. jQuery not only provides full support for all the CSS selectors but also introduces other ones. We’ll also introduce you to filters, many of which are special jQuery-only selectors that usually work with other types of selectors to further reduce a set of matched elements. As if this weren’t enough, you’ll learn how to create custom filters (also referred to as custom selectors or custom pseudo-selectors) in case your pages need one the library doesn’t support. We’ll also discuss context, the second parameter of the $() function, and describe the implications of its use.

2.1. Selecting elements for manipulation

 
 
 

2.2. Basic selectors

 
 
 
 

2.3. Retrieving elements by their hierarchy

 

2.4. Selecting elements using attributes

 

2.5. Introducing filters

 
 
 

2.6. Enhancing performances using context

 
 

2.7. Testing your skills with some exercises

 
 
 

2.8. Summary

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest