jquery check all checkboxes code example
Example 1: checkbox on click jquery select all
$("#checkAll").click(function(){
$('input:checkbox').not(this).prop('checked', this.checked);
});
Example 2: jquery get all checkbox checked
$('.theClass:checkbox:checked')
Example 3: select all checkboxes jquery
$('input:checkbox').prop('checked', true);
Example 4: select all checkbox jquery
$('#select_all').change(function() {
var checkboxes = $(this).closest('form').find(':checkbox');
checkboxes.prop('checked', $(this).is(':checked'));
});
Example 5: find all checkbox inside div jquery
$('#selectChb').click(function(){
$(':checkbox').prop("checked", true);
});
Example 6: 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>