Thanks for the heads up on that, I've obviously picked that up as a bad habbit from some examples built on older versions, I'll be sure to get rid of it! :-)
Thanks Robert -----Original Message----- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of MorningZ Sent: 18 February 2009 15:49 To: jQuery (English) Subject: [jQuery] Re: Checkboxes enabled/disable button Don't use "@".... well, don't use it if you plan on ever using jQuery over version 1.3... because it's not supported.... even if you are using an older version, loose the "@", it's not needed On Feb 18, 10:13 am, "Robert Rawlins" <robert.rawl...@thinkbluemedia.co.uk> wrote: > Morningz, > > Thank you for this! I made a couple of small changes, like so: > > if ($("inp...@name='my_checkbox']:checked").length == 0) { > > and it worked a real treat!! > > Thank you for your advice, I appreciate it! > > Robert > > -----Original Message----- > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > > Behalf Of MorningZ > Sent: 18 February 2009 13:11 > To: jQuery (English) > Subject: [jQuery] Re: Checkboxes enabled/disable button > > if ($("checkbox[name='my_checkbox']:checked").length == 0) { > //None are checked > } > else { > //At least one is checked > } > > Sir Rawlins wrote: > > Hello Guys, > > > Fairly noobish here so hoping to learn a little something from this > > challenge. > > > I have a form which contains a bunch of different checkboxes (all the > > same name) and a bunch of different button elements. I want to by > > default have these buttons disabled unless at least one checkbox is > > checked, if no checkboxes are checked then they need to be disabled. > > > <input type="checkbox" name="my_checkbox" /> > > <input type="checkbox" name="my_checkbox" /> > > <input type="checkbox" name="my_checkbox" /> > > <input type="checkbox" name="my_checkbox" /> > > <input type="checkbox" name="my_checkbox" /> > > > <button type="button">Click me to do something</button> > > <button type="button">Click me to do something else</button> > > <button type="button">Click me to do something cool</button> > > <button type="button">Click me to do nothing</button> > > > If this were just a single checkbox then I could figure this out > > without too much hassle but I'm unsure as to how I should be checking > > is any of the boxes are checked, presumably we can do some sort of > > array count for instances of it or something? who knows? > > > I'd appreciate your thoughts on this guys. > > > Robert