Discussion:
How to select every checkbox on my page inside a fieldset
ReynierPM
2010-02-15 13:16:12 UTC
Permalink
Hi:
I have a fieldset and a set of check boxes inside. I want when I pick
one, for example: <input type='checkbox' id='pick_all'
value='picked_all' /> Pick all check boxes all the check boxes will be
checked. How?
--
Cheers
ReynierPM
Peter Edwards
2010-02-15 13:54:13 UTC
Permalink
You can use selectors to do this quite easily - I've posted an example at:

http://jsbin.com/uwaxo/

This has:
1. a checkbox which will select/deselect all others in the page (no
matter whether they are in different forms/fieldsets,
2. a checkbox which uses a descendant selector $('#fieldset1
input:checkbox') to explicitly target a given fieldset by ID, and
3. a checkbox which uses its place in the DOM to select checkboxes which
are within the same fieldset it is part of.

I hope one of these addresses your problem
Post by ReynierPM
I have a fieldset and a set of check boxes inside. I want when I pick
one, for example: <input type='checkbox' id='pick_all'
value='picked_all' /> Pick all check boxes all the check boxes will be
checked. How?
ReynierPM
2010-02-15 14:06:08 UTC
Permalink
Post by Peter Edwards
2. a checkbox which uses a descendant selector $('#fieldset1
input:checkbox') to explicitly target a given fieldset by ID, and
Thx a lot Peter, you and jQuery rocks. It works perfectly for descendant
selector #fieldset1 ;)
--
Cheers
ReynierPM
Loading...