jQuery :evenSelector

jQuery 选择器jQuery Selector

Examples

Select every other (even) <tr> element:

$("tr:even")

Try it yourself »

Definition and Usage

The :even selector selects each element with an even index number (such as: 0, 2, 4, etc.).

Index values start at 0; the first element is even (0), the second element is odd (1), and so on.

Most common usage: used together with other selectors to select every even-indexed element in a specified combination (as in the example above).

Tip:Please use the:oddselector to select elements with odd index numbers.


Syntax

$(":even")


jQuery 选择器jQuery Selector

Other extensions