Latest web development tutorials

jQuery: odd selector

jQuery selector jQuery selector

Examples

Select each spaced (odd) <tr> element:

$("tr:odd")

try it"

Definition and Usage

: Odd selector to select each element with an odd index number (for example: 1,3,5, etc.).

Index starting from 0, the first element is an even number (0), the second element is an odd number (1), and so on.

The most common usage: used in conjunction with other selectors, select the specified combination of each odd-numbered elements (such as the above example).

Tip: Use : even selectors to select elements with even-numbered.


grammar

$(":odd")


jQuery selector jQuery selector