Multiple groups or radio buttons
<h1>Question 1</h1>
<input type="radio" name="radio1" value="false" />
<input type="radio" name="radio1" value="true" />
<h1>Question 2</h1>
<input type="radio" name="radio2" value="false" />
<input type="radio" name="radio2" value="true" />
How can I check in jQuery that a radio button in each group is checked?
Thank you.
Here is how I would do it:
That way you do not need to rely on sibling or parent tags. If your radio buttons are mixed up with whatever tag, it’ll still work. You can play around with it.