$('#checkall').click(function () {
$('.checkbox').prop('checked', this.checked);
});
$('.checkbox').change(function () {
var check = ($('.checkbox').filter(":checked").length == $('.checkbox').length);
$('#checkall').prop("checked", check);
});
<input type="checkbox" name="checkbox" id="<? echo $id ?>" class="checkbox" />
When I select the checkall box, it does not check all of the checkboxes.