Latest web development tutorials

jQuery: lt () selector

jQuery selector jQuery selector

Examples

Select the front 4 <tr> element:

$("tr:lt(4)")

try it"

Definition and Usage

: Lt () selector select index value is less than the specified number of elements.

index value starts from zero.

The most common usage: used in conjunction with other selectors, select the specified combination of elements in a specific number before (as in the above example).

Tip: Use : gt selector to select the index value is greater than the specified number of elements.


grammar

$(":lt(index)")

参数 描述
index 必需。规定要选择的元素。
会选取 index 值小于指定数字的元素。


jQuery selector jQuery selector