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 unch
Mtich,
I like to toggle checkbox states by emulating a click. This allows for any
bound events to also trigger.
$(":checkbox").click()
~Sean
that sounds like a cool idea
-GTG
On 8/5/07, Sean Catchpole <[EMAIL PROTECTED]> wrote:
>
> Mtich,
>
> I like to toggle checkbox states by emulating a click. This allows for any
> bound events to also trigger.
> $(":checkbox").click()
>
> ~Sean
>
kbox).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
ry-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Sean Catchpole
Sent: Sunday, August 05, 2007 2:18 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Turning a checkbox on and off
Mtich,
I like to toggle checkbox states by emulating a click. This allows for any
bound events to also
ed") ) {
alert("checked"); }
Mitch
From:
jquery-en@googlegroups.com [mailto:jquery-en@googlegroups.com] 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
on'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 chec
> *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.
&
com] 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
ch
ay 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 hav
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: Tu
Mitchell Waite wrote:
Do you know of a good place to learn more about using “:” and all those
other characters listed in the docs?
http://docs.jquery.com/DOM/Traversing/Selectors
http://www.w3.org/TR/2005/WD-css3-selectors-20051215/#pseudo-classes
--Klaus
t;
> 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:jquery-en@googlegroups.com]
> *On Behalf Of *Marshall
e it does, but so does $('your_selector').attr('checked','hi
> > mom');
>
> > And try unselecting it.
>
> > *From:* jquery-en@googlegroups.com
> > [mailto:jquery-en@googlegroups.com]
> > *On Behalf Of *Marshall Salinger
> > *Sen
> How do you check and uncheck a checkbox from jQuery?
This is another item that is in the FAQ:
http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_check.2Funcheck_an_input.3F
--John
ot;); }
>
>
>
> 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
>
>
>
>
16 matches
Mail list logo