$("#checkAll").click(function(){
$('input:checkbox').not(this).prop('checked', this.checked);
});
$('input:checkbox').prop('checked', true);
$('#select_all').change(function() {
var checkboxes = $(this).closest('form').find(':checkbox');
checkboxes.prop('checked', $(this).is(':checked'));
});
//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>