JSFiddle - React, Tailwind, and code Playground

by Mark Coleman

HTML

<input type="radio" class="deselectRadioButton" checked/>
<input type="radio" class="deselectRadioButton" />

JavaScript

$(".deselectRadioButton").click( function(e){
    if($(this).hasClass("on")){
       $(this).removeAttr('checked');
    }
    $(this).toggleClass("on");
}).find(":checked").addClass("on");