JSFiddle - React, Tailwind, and code Playground
HTML
<span class='radioholder'><input type='radio' value='test' name='test'/>
<input type='radio' value='test1' name='test'/>
<input type='radio' value='test2' name='test'/>
<input type='radio' value='test3' name='test'/>
<input type='radio' value='test4' name='test'/>
<input type='radio' value='test5' name='test'/></span>
CSS
.theone {
background-color:red;
}
JavaScript
$("input:radio").on("click",function (e) {
var inp=$(this);
if (inp.is(".theone")) {
inp.prop("checked",false).removeClass("theone");
} else {
$("input:radio[name='"+inp.prop("name")+"'].theone").removeClass("theone");
inp.addClass("theone");
}
});