You've got issues elsewhere in your code that you don't show: http://jsbin.com/ocode/edit
On Oct 1, 2:16 pm, "bob.nel...@gmail.com" <bob.nel...@gmail.com> wrote: > I have a bunch of checkboxes that I want to have checked when the user > checks a master checkbox. I've done this before and reused the working > code, but changed some DOM id's. The problem is its not working. I've > narrowed it down to is(':checked') as always returning false. Again, > I've reused working code from within the same site. The only thing > different are the id's. Here is my code: > > HTML for master checkbox (within a container with id 'msgsInbox'): > <input id="msgCheckAllInbox" name="msgCheckboxAllInbox" > type="checkbox" value="" onclick="checkAllMsgsIn()" tabindex="-1" /> > > HTML for series of checkboxes: > <input id="msg2531cb" name="msgCheckbox[]" class="messageCheckbox" > type="checkbox" value="2531" tabindex="-1" /> > <input id="msg2532cb" name="msgCheckbox[]" class="messageCheckbox" > type="checkbox" value="2532" tabindex="-1" /> > ETC... > > Javascript for master checkbox onclick function: > function checkAllMsgsIn() { > alert($('#msgCheckAllInbox').is(":checked")); //Used to debug this > problem, will always returns false > $('#msgsInbox input.messageCheckbox').attr('checked', $ > ('#msgCheckAllInbox').is(':checked')); > //$('#msgsInbox input.messageCheckbox').attr('checked', > true); //This will check all the boxes, so my jquery identifier is > correct. > > } > > I've search through my entire site to make sure there isn't another > element named 'msgCheckAllInbox'. There is not. So I'm stumped with > this one. > > Any ideas? Thank you in advance for any help.