JSFiddle - React, Tailwind, and code Playground
HTML
<input name="show[1]" type="radio" value="1" /> Show<br>
<input name="show[1]" type="radio" value="0" /> Hide<br>
<input name="show[2]" type="radio" value="1" /> Show<br>
<input name="show[2]" type="radio" value="0" /> Hide<br>
<input name="show[3]" type="radio" value="1" /> Show<br>
<input name="show[3]" type="radio" value="0" /> Hide<br>
<button>Check</button>
JavaScript
function check_radio_buttons() {
var i=1;
while ($("input[name='show[" + i + "]']").attr("value")) {
if(!$("input[name='show[" + i + "]']:checked").attr("value")) {
return false;
}
i++;
}
return true;
}
$("button").click( function () {
alert(check_radio_buttons());
});