jQuery | :lt() Selector
The :lt() selector selects elements using an index number which works on less than a specified number. The index numbers starts from 0.
Syntax:
$(":lt(index)")
Parameter:
- index: Index number which is selected. Element which is lesser than the specified index number is selected.
Example:
<!DOCTYPE html> <html> <head> <script src= </script> <script> $(document).ready(function() { $("ol:lt(3)").css( "background-color", "green"); }); </script> </head> <body> <h1>Welcome to My Web Page</h1> <ol id="1"> <li>GEEKS</li> <li>FOR</li> <li>GEEKS</li> </ol> <ol id="2"> <li>GEEKS</li> <li>FOR</li> <li>GEEKS</li> </ol> <ol id="3"> <li>GEEKS</li> <li>FOR</li> <li>GEEKS</li> </ol> <ol id="4"> <li>GEEKS</li> <li>FOR</li> <li>GEEKS</li> </ol> </body> </html> |
chevron_right
filter_none
Output:

Recommended Posts:
- jQuery | :has() Selector with example
- jQuery | :gt() Selector
- jQuery | :contains() Selector
- jQuery | :even Selector
- jQuery | :first Selector
- jQuery | :odd Selector
- jQuery | :last Selector
- jQuery | * Selector
- jQuery | :not() Selector
- jQuery | #id Selector
- jQuery | :submit Selector
- jQuery | [attribute$=value] Selector
- jQuery | :parent Selector
- jQuery | :file Selector
- jQuery | :last-child Selector
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



