What is the best way to validate to ensure at least one in every group is checked, so in the following example groups are name1
, name2
, name3
?
Example
<input type="radio" name="name1">
<input type="radio" name="name1">
<input type="radio" name="name1">
<input type="radio" name="name2">
<input type="radio" name="name2">
<input type="radio" name="name2">
<input type="radio" name="name3">
<input type="radio" name="name3">
<input type="radio" name="name3">
I know I can wrap a div around each one and then check each radio button in the div, but I am looking for a more dynamic solution. So, if in future more radio buttons are added, the jQuery code would not need to be altered or the divs would not need to be added - I hope this makes sense.