JSFiddle - React, Tailwind, and code Playground

by Norlihazmey Ghazali

HTML

<fieldset>
    <input type="radio" name="21">
    <label for="21">Answer 21</label>
    <input type="radio" name="22" class="checked">
    <label for="22">Answer 22</label>
    <input type="radio" name="23" class="">
    <label for="23">Answer 23</label>
    <input type="radio" name="24">
    <label for="24">Answer 24</label>
</fieldset>

JavaScript

$("input[type='radio']").click(function (event) {       
            $("input[type='radio']").prop('checked',false);
            $(this).prop('checked',true);      
    });