jQuery :lt()Selector

jQuery 选择器jQuery Selectors

Example

Select the first 4 <tr> elements:

$("tr:lt(4)")

Try it yourself »

Definition and Usage

The :lt() selector selects elements whose index value is less than a specified number.

Index values start from 0.

Most common usage: use it together with other selectors to select elements before a specific sequence number in a specified group (as in the example above).

Tip:Use:gt selectorto select elements whose index value is greater than a specified number.


Syntax

$(":lt(index)")

Parameter Description
index Required. Specifies the elements to select.
Selects elements whose index value is less than a specified number.


jQuery 选择器jQuery Selectors

Other extensions