Something like this perhaps ?
I do this based on the value attribute, if it's on = check it.  The
'data' part is JSON.  It's should be easy to convert this to an array.

It's actually a workaround for IE troubles I have:

               $.each(data, function(){
                  var myid='#check'+this.groupID;
                  if(this.value=="on") {
                     $(myid).attr("checked",true);
                  } else {
                     $(myid).attr("checked",false);
                  }
               });

If you'd interested in the reason, here's my story:

http://foobar.no-ip.org/flydom-jquery-and-input-checkboxes-under-ie-browsers/

hubbs schreef:
> I figured it out, I just had my server write the jQuery attributes:
>
> $("#12").attr("checked", "checked");
>
> On Aug 22, 11:58�am, hubbs <[EMAIL PROTECTED]> wrote:
> > There is also the option of me putting the checked values into an
> > array if that would help with this...
> >
> > On Aug 22, 11:27�am, hubbs <[EMAIL PROTECTED]> wrote:
> >
> > > I am looking for ideas on how to check some checkboxes based on a list
> > > of id's that match the id's of the checkboxes.
> >
> > > Example:
> >
> > > <div id="checkedValues">
> > > 10, 14, 11
> > > </div>
> >
> > > <div id="checkBoxes">
> > > <input type="checkbox" value="1" id="10" name="10" />
> > > <input type="checkbox" value="1" id="11" name="11" />
> > > <input type="checkbox" value="1" id="12" name="12" />
> > > <input type="checkbox" value="1" id="13" name="13" />
> > > <input type="checkbox" value="1" id="14" name="14" />
> > > </div>
> >
> > > In this example, when the page loads, I need the checkboxes with id's
> > > 10, 14, and 11 to be checked, and the rest to remain unchecked. �The
> > > values in checkedValues come from the server, so I need to mirror
> > > these with a checked value if that id comes up within the
> > > checkedValues div.
> >
> > > I know there must be an easy, or better way to do this, just looking
> > > for ideas. �Thanks!

Reply via email to