how to select multiple radio buttons with different names with one label?
here's a simple example of what i'm trying to achieve...
<input id="1A" type="radio" name="first" value="A">firstA<br>
<input id="1B" type="radio" name="first" value="B">firstB<br>
<input id="2A" type="radio" name="second">secondA<br>
<input id="2B" type="radio" name="second">secondB<br>
<input id="3A" type="radio" name="third">thirdA<br>
<input id="3B" type="radio" name="third">thirdB<br>
<label for="1A">
<label for="2B">
<label for="3A">
<div>1A / 2B / 3A</div>
</label>
</label>
</label>
so when i click the "1A / 2B / 3A" i want it to select make a select 3 radio buttons (firstA, secondB, thirdA), any ideas?
Assuming that the labels are always properly nested, the click
event will propagate naturally. You can just set the checked property manually then:
$("label").on('click', function () {
$("#" + $(this).attr('for')).prop('checked', true);
});