I want to write jQuery only to turn on the switches, depending on which radio buttons are currently selected according to any business logic.
Essentially, there are 3 groups of 3 radio buttons that end up looking something like this (my apologies for being detailed with this HTML example, but hoping this will show what I mean):
<p>
<label for="group_one">Group One</label>
</p>
<p>
<div class="group_one">
<div id="group_one_choice_one">
<label for="group_one_choice_one">Choice One</label>
<br />
<input checked="checked" id="choice_one" type="radio" value="1" />
<br />
</div>
<div id="group_one_choice_two">
<label for="group_one_choice_two">Choice Two</label>
<br />
<input id="group_one_choice_two" type="radio" value="2" />
<br />
</div>
<div id="group_one_choice_three">
<label for="group_one_choice_three">Choice Three</label>
<br />
<input id="choice_three" type="radio" value="3"/ >
<br />
</div>
</div>
</p>
<p>
<label for="group_two">Group Two</label>
</p>
<p>
<div class="group_two">
<div id="group_two_choice_one">
<label for="group_two_choice_one">Choice One</label>
<br />
<input checked="checked" id="choice_one" type="radio" value="1" />
<br />
</div>
<div id="group_two_choice_two">
<label for="group_two_choice_two">Choice Two</label>
<br />
<input id="group_two_choice_two" type="radio" value="2" />
<br />
</div>
<div id="group_two_choice_three">
<label for="group_two_choice_three">Choice Three</label>
<br />
<input id="choice_three" type="radio" value="3"/ >
<br />
</div>
</div>
</p>
<p>
<label for="group_three">Group Three</label>
</p>
<p>
<div class="group_three">
<div id="group_three_choice_one">
<label for="group_three_choice_one">Choice One</label>
<br />
<input checked="checked" id="choice_one" type="radio" value="1" />
<br />
</div>
<div id="group_three_choice_two">
<label for="group_three_choice_two">Choice Two</label>
<br />
<input id="group_three_choice_two" type="radio" value="2" />
<br />
</div>
<div id="group_three_choice_three">
<label for="group_three_choice_three">Choice Three</label>
<br />
<input id="choice_three" type="radio" value="3"/ >
<br />
</div>
</div>
</p>
Where this is difficult, the logic should be determined which switches to display and what to enable. The user must select one option from each group, but cannot repeat the same selection from one group to another.
Ideally, when a user lands on a page, all radio buttons will be available, but not selected.
() , script , . , ..
, . jQuery, , , , , - . !