jQuery:Selector :lt(index)

:lt(index)

Overview

Matches all elements that are less than the given index value.

Parameter

index  Number  V1.0

Counts from 0.

Demo

Description:

Look for the first and second rows, the index values are 0 and 1, that is, less than 2.

HTML code:
<table>
  <tr><td>Header 1</td></tr>
  <tr><td>Value 1</td></tr>
  <tr><td>Value 2</td></tr>
</table>
jQuery code:
$("tr:lt(2)")
Result:
[ <tr><td>Header 1</td></tr>, <tr><td>Value 1</td></tr> ]

Leave a Reply

Your email address will not be published. Required fields are marked *