Skip to content
Related Articles

Related Articles

jQuery | :lt() Selector
  • Last Updated : 27 Feb, 2019

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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


Output:




My Personal Notes arrow_drop_up
Recommended Articles
Page :