Select all checkbox jQuery

  <th><input type="checkbox" id="selectAll"></th>
<input type="checkbox" class="id" >
<input type="checkbox" class="id" >
<input type="checkbox" class="id" >
<script>

$(document).ready(function() {
$("#selectAll").click(function(){

if( $(this).prop("checked")) {
              $(".id").prop("checked", false);
          } else {
              $(".id").prop("checked", true);
          }

});
});

  </script>

Leave a Reply