Thanks for that demo. I see the problem now. When you first stated the idea you presented this to me
I missed the ":" in the $("#check1").is(":checked") part. That is critical. Its one of those things I am not familiar with that makes me so poor at JQ. Anyway I apologize for saying your code did not work. Mitch From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Ganeshji Marwaha Sent: Sunday, August 05, 2007 4:33 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Turning a checkbox on and off Mitch, I have whipped up a demo page for u... http://www.gmarwaha.com/jquery/jcarousellite/test/testCheckboxChecked.html follow the instructions there. Both the techniques i mentioned initially are working in all 4 major browsers. -GTG On 8/5/07, Mitchell Waite <[EMAIL PROTECTED]> wrote: Yes that's true it does, but so does $('your_selector').attr('checked','hi mom'); And try unselecting it. From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Marshall Salinger Sent: Sunday, August 05, 2007 4:06 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Turning a checkbox on and off I am not sure I follow. $('your_selector').attr('checked','checked'); does set a checkbox to checked. -Marshall Mitchell Waite wrote: I thought the same about checking a checkbox but "checked" is not the right value, you have to use true and false. So like this: On $(checkbox).attr("checked", true); Off $(checkbox).attr("checked", false); I have no idea why you cant do $(checkbox).attr("checked", "checked"); This also won't work if( $(checkbox).is(":checked") ) { alert("checked"); } Mitch From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Ganeshji Marwaha Sent: Sunday, August 05, 2007 1:54 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Turning a checkbox on and off To determine if a checkbox is checked, i would use if( $(checkbox).is(":checked") ) { alert("checked"); } To check a checkbox, $(checkbox).attr("checked", "checked"); Both are untested, but let me know how it goes -GTG On 8/5/07, Mitch <[EMAIL PROTECTED]> wrote: How do you check and uncheck a checkbox from jQuery? And how do you determine if a checkbox has been checked or unchecked? I tried attr and css and none of them worked. Thanks Mitch