Select 4 items with jquery - Javascript jQuery

Javascript examples for jQuery:Selector

Description

Select 4 items with jquery

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.6.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*from  w w w  . j  a  va2 s.  c  o m*/
$(function(){
   $('ul li:lt(3)').css('color','red');
});
    });

      </script> 
 </head> 
 <body> 
  <ul> 
   <li>1</li> 
   <li>2</li> 
   <li>3</li> 
   <li>4</li> 
   <li>5</li> 
   <li>6</li> 
  </ul>  
 </body>
</html>

Related Tutorials