jQuery :odd selector

Example

Select each alternate (odd) <tr> element:

$("tr:odd")

Try it yourself

Definition and usage

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

The index value starts from 0, and the first element is even (0).

The most common usage: used together with other elements/selectors to select elements with odd numbers in the specified group (such as the example above).

Syntax

$(":odd")

Tips and comments

Tip:Please use :even selectorto select elements with even numbers.