Chapter 3. Selectors and filters

This chapter covers

  • Existing types of jQuery selectors
  • Adding your own pseudo-class selectors
  • Adding set filters

One of the principles behind jQuery is the select-and-act mode of operation—you select one or more elements of interest and then do something with them. jQuery includes an embedded copy of the Sizzle selector engine (“a pure JavaScript CSS selector engine designed to be easily dropped into a host library”; http://sizzlejs.com/) to perform your selections. Internally, Sizzle delegates to built-in browser functionality when available, and it applies the selectors itself in JavaScript if necessary.

Although numerous built-in selectors are available, sometimes it’s cleaner and clearer to create ...

Get Extending jQuery now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.