JSFiddle - React, Tailwind, and code Playground
HTML
<table>
<tr class="radioList">
<td>Question 1: </td>
<td>
<input type="radio" name="q1" value="qwe1">
<input type="radio" name="q1" value="qwe2">
<input type="radio" name="q1" value="qwe3">
</td>
</tr>
<tr class="radioList">
<td>Question 2: </td>
<td>
<input type="radio" name="q2" value="qwe1">
<input type="radio" name="q2" value="qwe2">
<input type="radio" name="q2" value="qwe3">
</td>
</tr>
<tr class="radioList">
<td>Question 3: </td>
<td>
<input type="radio" name="q3" value="qwe1">
<input type="radio" name="q3" value="qwe2">
<input type="radio" name="q3" value="qwe3">
</td>
</tr>
</table>
<button onClick="isCheck();">Go!</button>
JavaScript
function isCheck() {
var isOk = true;
$('.radioList').each(function(){
var countChecked = $(this).find(':checked').length;
if(countChecked!=1) {
$(this).css('color', 'red');
isOk = false;
} else {
$(this).css('color', 'black');
}
});
return isOk;
}