JSFiddle - React, Tailwind, and code Playground
HTML
<input type="radio" name="int" id="0" value="none">None
<input type="radio" name="int" id="10" value="Ten">10
<input type="radio" name="int" id="20" value="Twenty">20
<input type="radio" name="int" id="30" value="Thirty">30
JavaScript
var values = document.getElementsByName("int");
function getValue() {
for(var i = 0; i < values.length; i++) {
if(values[i].checked == true) {
selectedValue = values[i].value;
console.log('value=' + selectedValue);
}
}
}
// Just to cause the test to run
for(var i = 0; i < values.length; i++) {
values[i].onclick = getValue;
}