Link to home
Start Free TrialLog in
Avatar of Brad Bansner
Brad Bansner

asked on

jQuery: selecting a checkbox by DIV, class and checked status

If I have these elements:

<div id="question1">
<input type="checkbox" class="answerCheckbox" value="1" />
</div>

...I can select the box, only if it is checked, like this:

$('#question1 :checkbox:checked')

But, how can I also add the class to make sure any other checkboxes are not selected? I tried this:

$('#question1 .answerCheckbox :checkbox:checked')

...but that did not work. Thanks!
ASKER CERTIFIED SOLUTION
Avatar of StingRaY
StingRaY
Flag of Thailand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Brad Bansner
Brad Bansner

ASKER

Ah, perfect. Thanks!