Latest web development tutorials

jQuery: even selectors

jQuery selector jQuery selector

Examples

Select each spaced (even) <tr> element:

$("tr:even")

try it"

Definition and Usage

: Even selectors select every element with even index numbers (example: 0,2,4, 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 even-numbered elements (such as the above example).

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


grammar

$(":even")


jQuery selector jQuery selector