JSFiddle - React, Tailwind, and code Playground

HTML

<input type="radio" id="radio1" name="myRadio" value="option-1" />
<label for="radio1">Swing Gate</label><br/>


<input type="radio" id="radio2" name="myRadio" value="option-2" />
<label for="radio2">Swing Gate</label>

<div><button onclick="$('input').toggle()">Toggle Radio Visibility</button></div>

CSS

input { display: none; }
.selected { background: #abcdef; }

JavaScript

var $radios = jQuery('input[type=radio]');
$radios.change(function() {
   $radios.next().removeClass('selected');
   $radios.filter(':checked').next().addClass('selected');
});