On Oct 1, 1:16 pm, "[email protected]" <[email protected]>
wrote:
> I have a bunch of checkboxes that I want to have checked when the user
> checks a master checkbox.
You are writing too much unnecessary jQuery code!
> HTML for master checkbox (within a container with id 'msgsInbox'):
> <input id="msgCheckAllInbox" name="msgCheckboxAllInbox"
> type="checkbox" value="" onclick="checkAllMsgsIn()" tabindex="-1" />
Try: onclick="checkAllMsgsIn(this)"
Then:
> function checkAllMsgsIn() {
> alert($('#msgCheckAllInbox').is(":checked")); //Used to debug this
> $('#msgsInbox input.messageCheckbox').attr('checked', $
> ('#msgCheckAllInbox').is(':checked'));
function checkAllMsgsIn(cb) {
$('#msgsInbox input.messageCheckbox').attr('checked', cb.checked);
}
Much simpler.
Matt Kruse