JSFiddle - React, Tailwind, and code Playground
by CorFlamberg
HTML
<input type="radio" name="r" checked value=l>1<br>
<input type="radio" name="r" value=2>2<br>
<input type="radio" name="r" value=3>3<br>
<hr/>
<input type="button" value="check" onclick="check()" />
<br/>
<input type="button" value="check jQuery" onclick="check2()" />
JavaScript
function check()
{
var inp = document.getElementsByName('r');
for (var i = 0; i < inp.length; i++) {
if (inp[i].type == "radio" && inp[i].checked) {
alert("selected: " + inp[i].value);
}
}
}
function check2()
{
alert("selected: " + $('input[name=r]:checked').val());
}