How to check first 200 chekboxes , then next 200 and so on?

This is the working eg of first 3 and next 3 check boxes, but as suggestion please don’t have these many check boxes, the user experience is very bad in this case.

 $(document).ready(function() {
       var $cbs = $('input:checkbox'),
           $links = $("a"); 

       $links.click(function() {
          var start = $links.index(this) * 3,
              end = start + 3;
              $cbs.slice(start,end).prop("checked",true);
       });
    });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<a href=#>Check 1-3</a>
<a href=#>Check 4-7</a>


<input type="checkbox" name="checkbox[1]" value="1">
<input type="checkbox" name="checkbox[2]" value="2">
<input type="checkbox" name="checkbox[3]" value="3">
<input type="checkbox" name="checkbox[4]" value="4">
<input type="checkbox" name="checkbox[4]" value="5">
<input type="checkbox" name="checkbox[4]" value="6">
<input type="checkbox" name="checkbox[4]" value="7">

Leave a Comment