Basic JQuery filters

Filters work with selectors and provide a great control for selecting the elements in DOM. So basically it makes easy our work for selecting elements in DOM.

JQuery filters fall in to six different categories. 
  1. Basic filters
  2. Content filters
  3. Visibility filters
  4. Attribute filters
  5. Child filters
  6. Form filters
In this post I'm going to discuss about Basic JQuery filters. It provides basic filtering like getting first, last and even and odd numbered items in a returned set.

A List of usage of JQuery filters.


Filter Purpose
:first selects only the first instance of the selector's returned set
:last selects only the last instance of the selector's returned set
:even selects only even numbered elements of the selector's returned set
:odd selects only odd numbered elements of the selector's returned set
:eq(n) filters out elements that are positioned at the given index
:gt(n) include elements that are past the given index
:lt(n) include elements that are before the given index
:header select all header elements (H1, H2, H3 etc)
:animated selects all elements that are currently being animated in some way
:not(selector) includes elements that do not match the given selector

This is just a list of what can be done with JQuery filters.

Please refer this post for practical examples of usage of JQuery basic selectors.

No comments:

Post a Comment