I was wondering if there's a way to have an unlimited amount of groups of checkboxes, each with their own "master" checkbox at the top which when checked would check all of the other boxes in that coresponding group.
Now the catch is, ALL the checkboxes need to have the same name and ID. So the script cant really say, "when this master box is checked also check all other checkboxes with the name or ID so and so...".
They all also need to be part of the same form.
Anyone have any ideas?
Heres what the base HTML would look like:
Code:
<form>
<input type="checkbox" name="masterBox"> (master checkbox)<br>
<input type="checkbox" name="itmBox" id="itmBox" value="random"> 1<br>
<input type="checkbox" name="itmBox" id="itmBox" value="random"> 2<br>
<input type="checkbox" name="itmBox" id="itmBox" value="random"> 3<br>
<input type="checkbox" name="itmBox" id="itmBox" value="random"> 4<br>
<hr>
<input type="checkbox" name="masterBox"> (master checkbox)<br>
<input type="checkbox" name="itmBox" id="itmBox" value="random"> 1<br>
<input type="checkbox" name="itmBox" id="itmBox" value="random"> 2<br>
<input type="checkbox" name="itmBox" id="itmBox" value="random"> 3<br>
<input type="checkbox" name="itmBox" id="itmBox" value="random"> 4<br>
<hr>
<input type="checkbox" name="masterBox"> (master checkbox)<br>
<input type="checkbox" name="itmBox" id="itmBox" value="random"> 1<br>
<input type="checkbox" name="itmBox" id="itmBox" value="random"> 2<br>
<input type="checkbox" name="itmBox" id="itmBox" value="random"> 3<br>
<input type="checkbox" name="itmBox" id="itmBox" value="random"> 4<br>
<hr>
<input type="checkbox" name="masterBox"> (master checkbox)<br>
<input type="checkbox" name="itmBox" id="itmBox" value="random"> 1<br>
<input type="checkbox" name="itmBox" id="itmBox" value="random"> 2<br>
<input type="checkbox" name="itmBox" id="itmBox" value="random"> 3<br>
<input type="checkbox" name="itmBox" id="itmBox" value="random"> 4<br>
<hr>
</form>