JSFiddle - React, Tailwind, and code Playground

by prestashop

HTML

<script src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/ui-lightness/jquery-ui.css">
<h1>Avant / Before :</h1>
<div><input id='one' name='myradio' type='radio' checked />radio 1</div>

<div><input id='two' name='myradio' type='radio' />radio 2</div>
<br><br>
<h1>Après / After :</h1>

<div class="ux"><input id='one' name='anotherradio' type='radio' checked class="input"/><label>radio 1</label></div>

    <div class="ux"><input id='two' name='anotherradio' type='radio' class="input" /><label>radio 2</label></div>

CSS

.selected label{
    background: yellow;
    color:green;
}
h1{
font-size:18px;
    font-style:bold;
    padding-bottom:5px;
}

JavaScript

$(document).ready(function () {
    
    $('.ux :radio:checked').parent().addClass('selected');
    $('.ux :radio').change(function () {
        $(':radio[name=' + this.name + ']').parent().removeClass('selected');
        $(this).parent().addClass('selected');
    });
});