jQuery :eq()Selector

jQuery 选择器jQuery Selectors

Examples

Select the second <p> element:

$("p:eq(1)")

Try it »

Definition and Usage

The :eq() selector selects an element with a specified index value.

The index value starts from 0, so the index value of the first element is 0 (not 1).

Most common usage: use it with other selectors to select an element with a specified index within a specified combination (like the example above).


Syntax

$(":eq(index)")

Parameter Description
index Required. Specifies the index of the element.


jQuery 选择器jQuery Selectors

Other Extensions