This solution is better because it is shorter and doesn't use a loop.
id="checkAll"
is the header column
$('#checkAll').on('click', function() {
if (this.checked == true)
$('#userTable').find('input[name="checkboxRow"]').prop('checked', true);
else
$('#userTable').find('input[name="checkboxRow"]').prop('checked', false);
});