[jQuery] Re: Selecting Checkboxes inside the table

2008-05-10 Thread Josh Nathanson
; Sent: Saturday, May 10, 2008 11:01 AM Subject: [jQuery] Re: Selecting Checkboxes inside the table That is very good way! What would be the best way to do check and uncheck based on the button click? On May 10, 12:48 pm, "Josh Nathanson" <[EMAIL PROTECTED]> wrote: Try this out:

[jQuery] Re: Selecting Checkboxes inside the table

2008-05-10 Thread AzamSharp
I guess this is the best way: // attach the event to the button control $("#btn_CheckAll").click(function() { $("#chkList input:checkbox").attr("checked",function() { this.checked = !(this.checked == true) }); }); On May 10, 12:48 pm, "Josh Nathanson" <[E

[jQuery] Re: Selecting Checkboxes inside the table

2008-05-10 Thread AzamSharp
That is very good way! What would be the best way to do check and uncheck based on the button click? On May 10, 12:48 pm, "Josh Nathanson" <[EMAIL PROTECTED]> wrote: > Try this out: > > $("#chkList input:checkbox").attr("checked",true); > > This says: "get all input fields of type checkbox, with

[jQuery] Re: Selecting Checkboxes inside the table

2008-05-10 Thread AzamSharp
I got it! $("#chkList").find("[EMAIL PROTECTED]").each(function() { this.checked = true; }); On May 10, 11:54 am, AzamSharp <[EMAIL PROTECTED]> wrote: > I am having trouble to check the checkboxes contained inside the HTML > table. > > Here is the table code: > > >

[jQuery] Re: Selecting Checkboxes inside the table

2008-05-10 Thread Josh Nathanson
Try this out: $("#chkList input:checkbox").attr("checked",true); This says: "get all input fields of type checkbox, within table id 'chkList', and set attribute checked of those inputs to true." You don't need to use the method "each" because jQuery will automatically iterate over the retur