I'm trying to deselect/select everything in the following dd.options based "dept_checkbox" being selected for each. Theres around 1 to 100+ checkboxes in each dd block( I put 2 courses in the first "dept_checkbox" section, and 1 in the next) for this snippet.
<div class="accordion">
<dt><input class="dept_checkbox" type="checkbox" onclick="selectAll($(this).parent().next(".options") )"><a href="">EYES|VISI</a></dt>
<dd class="options">
<li>
<label>
<input type="checkbox" name="course_EYES|VISI" value="course_XXX">XXX
</label>
</li>
<li>
<label>
<input type="checkbox" name="course_EYES|VISI" value="course_YYY">YYY
</label>
</li>
</dd>
<dt><input class="dept_checkbox" type="checkbox" onclick="selectAll($(this).parent().next(".options") )"><a href="">EARS|HEAR</a></dt>
<dd class="options">
<li>
<label>
<input type="checkbox" name="course_EARS|HEAR" value="course_EEE">EEE
</label>
</li>
</dd>
</div>
I got the following so far far but I'm not sure how to go about it, I'm trying to accomplish this with jquery.
function selectAll(pID ){
$('.'+pID).find(':checkbox').each(function(){
*SELECT ALL CHECKBOXES IN OPTIONS SECTION FOR THIS PARENT*
});
}
I'm trying to stay away from calling any of the 'name' or 'value' values since they all change. Only things stay static(they will appear with all results) are 'dept_checkbox' for each of the Select all checkboxes and 'options' class which would hold the checkboxes for the previous select/deselect all button to work with.
Aucun commentaire:
Enregistrer un commentaire