Slice start and end : slice « jQuery « JavaScript Tutorial






<html>
  <head>
    <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
           function colorEm() {
              var $div = $("div");
              $div.css("background", "red");
              $div.slice(2, 4).css("background", "yellow");   
           }
           $("button").click(colorEm);
        });
    </script>
    <style>
      div { width:40px; height:40px; margin:10px; float:left;}
    </style>
  </head>
  <body>
    <body>
      <button>Click the button</button>
          <div></div>
          <div></div>
          <div></div>
          <div></div>
          <div></div>
          <div></div>
          <div></div>
          <div></div>
          <div></div>
  </body>
</html>








30.98.slice
30.98.1.Slice start and end
30.98.2.Slice start till ends
30.98.3.Slices paragraphs to include only the first and second element.
30.98.4.Slices paragraphs to include only the second element.
30.98.5.Slice paragraphs to include only the second and third element.
30.98.6.Slice li under a ul
30.98.7.slice to the end