How to use lt() Selector Method in JQuery

This article describe about :lt() Selector Method in JQuery.
  • 2881

Use :lt() Selector method in jQuery

This method is used to find a specific index number less than a specified number.

In this method index number will be start at 0.

So the first element will have the index number 0 (not 1).

The :gt() method mostly use to another selector.


<!DOCTYPE html>



<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">

       $(document).ready(function () {

    $("tr:lt(4)").css("background-color", "yellow");





<h1>Welcome to This Page</h1>



  <th>Student id</th>



































You may also want to read these related articles here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

© 2020 DotNetHeaven. All rights reserved.