jquery checkbox checked all code example

Example 1: checkbox on click jquery select all

$("#checkAll").click(function(){
    $('input:checkbox').not(this).prop('checked', this.checked);
});

Example 2: select all checkboxes jquery

$('input:checkbox').prop('checked', true);

Example 3: find all checkbox inside div jquery

$('#selectChb').click(function(){ 
     $(':checkbox').prop("checked", true);
});

Example 4: select all checkbox jquery

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form>
  <table>
    <tr>
      <td><input type="checkbox" id="select_all" /></td>
    </tr>
    <tr>
      <td><input type="checkbox" name="select[]" /></td>
    </tr>
    <tr>
      <td><input type="checkbox" name="select[]" /></td>
    </tr>
    <tr>
      <td><input type="checkbox" name="select[]" /></td>
    </tr>
  </table>
</form>

Tags:

Html Example