Considering the following markup:
<form>
<div class="project">
<ul class="choice">
<li><label for="firstchoice_1">First choice</label><input type="radio" name="firstchoice" value="1" id="firstchoice_1" /></li>
<li><label for="secondchoice_1">Second choice</label><input type="radio" name="secondchoice" value="1" id="secondchoice_1" /></li>
</ul>
</div>
<div class="project">
<ul class="choice">
<li><label for="firstchoice_2">First choice</label><input type="radio" name="firstchoice" value="2" id="firstchoice_2" /></li>
<li><label for="secondchoice_2">Second choice</label><input type="radio" name="secondchoice" value="2" id="secondchoice_2" /></li>
</ul>
</div>
</form>
What I want to do is to disable one if the radio button in every .project
group whenever the other one was selected (so only First choice
or Second choice
in every group can be selected). What I know how to do is to disable one specific radio button in one specific case but I don't know how to generalize this as they may are a hundred of such .project
groups.
Edit: Please note that only of the whole First choice
(and vice versa) can be selected. The same name is already used for that one. The same name
attribute is used throughout the whole markup. There are only two different name
s.