<input type="checkbox" id="test1" />Check all A
<p id="test1">
<input type="checkbox" class="checkBoxClass" id="testA1" />A
<br />
<input type="checkbox" class="checkBoxClass" name="test" id="testA2" />A
<br />
<input type="checkbox" class="checkBoxClass" name="test" id="testA3" />A
<br />
<input type="checkbox" class="checkBoxClass" name="test" id="testA4" />A
<br />
<input type="checkbox" class="checkBoxClass" name="test" id="testA5" />A
<br />
</p>
<input type="checkbox" id="test2" />Check all B
<p id="test2">
<input type="checkbox" class="checkBoxClass" name="test" id="testB1" />B
<br />
<input type="checkbox" class="checkBoxClass" name="test" id="testB2" />B
<br />
<input type="checkbox" class="checkBoxClass" name="test" id="testB3" />B
<br />
<input type="checkbox" class="checkBoxClass" name="test" id="testB4" />B
<br />
<input type="checkbox" class="checkBoxClass" name="test" id="testB5" />B
<br />
</p>
<input type="checkbox" id="test3" />Check all C
<p id="test3">
<input type="checkbox" class="checkBoxClass" name="test" id="testC1" />C
<br />
<input type="checkbox" class="checkBoxClass" name="test" id="testC2" />C
<br />
<input type="checkbox" class="checkBoxClass" name="test" id="testC3" />C
<br />
<input type="checkbox" class="checkBoxClass" name="test" id="testC4" />C
<br />
<input type="checkbox" class="checkBoxClass" name="test" id="testC5" />C
<br />
</p>
I have 3 checkboxes with underlying 5 each checkboxes. If i check check All A, all underlying checkboxes should be selected. Same thing should happened as the other Check all B and Check all C are selected. If i have to undo either of the Check all A,B and C, its underlying boxes should be uncheck.How would i do it in html? It seems to be needing a javascript but i don't know where to start.And one thing, if i undo the check all , all underlying checkboxes should not be unchecked. Hope anyone can help me out here.
Aucun commentaire:
Enregistrer un commentaire