From the course: jQuery Essential Training

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Basic filters

Basic filters

- [Instructor] jQuery filters are used in conjunction with selectors in order to further refine a result set that comes back from a selector expression. In this chapter, we'll look at filters and then we'll see how they work in some example exercises. So let's look at the basic filters available in jQuery. I can use the first and last filters to select the first or the last instance of a given selector type. The filter is specified using a colon before the name of the filter. Similarly, I can use the even or odd filters to select only even or odd-numbered items. I can use expressions like greater than, less than, or equal to. So I can use these filters, for example, to select elements that are at or before or after a specific index. I can also specify that I only want to filter for items that are currently in the process of being animated. And this could be useful, for example, if you want to stop all the animations on a page. There's a filter to get the element that currently has the…

Contents