.even()Returns: jQuery
Description: Reduce the set of matched elements to the even ones in the set, numbered from zero.
Given a jQuery object that represents a set of DOM elements, the .even() method constructs a new jQuery object from the even elements in that set. Counting starts from zero!
Consider a page with a simple list on it:
|
1 2 3 4 5 6 7 |
|
We can apply this method to the set of list items:
|
1 |
|
The result of this call is a red background for the first, third & 5th items.
Example:
Highlight the even items in a list.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|