I'm trying to keep either All and a group of checkboxes (1, 2, 3) unchecked. For example, when All is unchecked and 1 is checked, if I click All, 1 should be unchecked, and vice versa.
<input type="checkbox" name="checkAll" class="selectAll" /> All <br/>
<input type="checkbox" name="checkuser" class="cb_box " /> 1
<input type="checkbox" name="checkuser" class="cb_box " /> 2
<input type="checkbox" name="checkuser" class="cb_box " /> 3
I tried in this way but it doesn't work. Any suggestion?
$(function () {
$('.selectAll').click(function () {
$('input[name=checkuser]').attr('unchecked', $(this).attr('checked'));
});