$('input[name=veggies]').attr('checked', true); By the way: putting the question into the subject instead of "question" will probably increase chances of your mail being read.
--Klaus On 16 Okt., 15:25, GARIL <[EMAIL PROTECTED]> wrote: > I used $(":checkbox").each(function() > {this.checked=this.name=="veggies"}) but I'm wondering if there's > another way, like using filter perhaps? > > On Oct 16, 8:06 am, GARIL <[EMAIL PROTECTED]> wrote: > > > Using jQuery, is there a quick way of setting the 'checked' attribute > > to true for all the 'veggies' below? > > Thank you. > > > <form name='store'> > > <input type="checkbox" name="veggies" value='2'>Banana > > <input type="checkbox" name="veggies" value='1'>Avocado > > <input type="checkbox" name="veggies" value='0'>Apple > > <input type="checkbox" name="veggies" value='3'>Papaya > > <input type="checkbox" name="veggies" value='4'>Plum > > <br> > > <input type="checkbox" name="fruits" value='a'>Broccoli > > <input type="checkbox" name="fruits" value='b'>Cabbage > > <input type="checkbox" name="fruits" value='c'>Radish > > <input type="checkbox" name="fruits" value='d'>Squash > > <input type="checkbox" name="fruits" value='e'>Cucumber > > </form>