jQuery :lt() Selector

The jQuery :lt() selector selects the items of group element less than the specified index number. Each item of a group element start with an index 0. If you specify the index value as 3, it selects the items given at index 0,1 and 2. These are the items whose index value is less than 3.

The syntax of the selector is given below.


You can specify the tag name or class before the selector name in order to select only the required element. Check examples given below to understand the way of using it.

Parameter Description

Sr. No. Parameter Name Description
1 n It is the index value of an item to select. Those items whose index value is less then this item is selected.

Examples of jQuery :lt Selector

The two different examples are showing below to explain the use of the jQuery :lt Selector. The first example uses the HTML table and the second example using the list element. You can click the below links to directly jump to the example.

Let’s start with the table element and select the required tr items.

jQuery :lt Selector to Select and Color Table Row Text Less Than Index 3

The rows of a table start with an index 0. The below example selects the item given at index 3. After the selection, it applies the CSS color to the elements less than index 3.



Sr. No. Footballer Name Country
1 Cristiano Ronaldo Portugal
2 Lionel Messi Argentina
3 Mohamed Salah Egypt
4 Kevin De Bruyne Belgium

Click the button given in the example above. It selects row items at index 0, 1 and 2 to apply the green color to its text content.

Select and Color List Item Text Less Than Index 3

Let’s use the selector to select the items of the list element. A list element items start with an index o. When you use the jQuery :lt() selector and specify the index value as 3. It selects and applies the color to the items less than the specified index.



  • Select list item less than the given index.
  • Apply color to the text of selected list item.
  • Tutorialdeep is the best place to learn jQuery.
  • Learn web development with our step-by-step tutorial guide.
  • Live examples are helpful to learn everything.

The above example contains the button and the list items. When you click the button given above, it applies the orange color to the text of list items.