var selected = []; // New array
$("#inputID input[type=checkbox]:checked").each(function () {
selected.push(this.value);
});
$("#checkAll").click(function(){
$('input:checkbox').not(this).prop('checked', this.checked);
});
var values=[];
$('input[name="your-checkbox-name[]"]:checked').each(function () {
values[values.length] = (this.checked ? $(this).val() : "");
});
$('input:checkbox').prop('checked', true);
$('.theClass:checkbox:checked')
$('#select_all').change(function() {
var checkboxes = $(this).closest('form').find(':checkbox');
checkboxes.prop('checked', $(this).is(':checked'));
});
$('#selectChb').click(function(){
$(':checkbox').prop("checked", true);
});
//html
<input type="checkbox" onclick="CheckAll(this)" id="checkboxAll" title="Select All" />
//jquery
function CheckAll(elem) {
$('[name="checkbox"]').prop("checked", $(elem).prop('checked'));
}
<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>