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
I hope you will find this helpful http://kawika.org/jquery/cssCheckbox/