jQuery :oddSelector

jQuery 选择器jQuery Selector

Examples

Select each every other (odd) <tr> element:

$("tr:odd")

Try it yourself »

Definition and Usage

The :odd selector selects each element with an odd index number (such as: 1, 3, 5, etc.).

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

The most common usage: use it together with other selectors to select each odd-numbered element in a specified combination (as in the example above).

Tip:Please use the:evenselector to select elements with even index numbers.


Syntax

$(":odd")


jQuery 选择器jQuery Selector

Other Extensions