JSFiddle - React, Tailwind, and code Playground

by Satinder singh

HTML

<div class="calsort btn-group" data-toggle="buttons">
    <label class="btn btn-primary ">
        <input type="radio" name="options" id="rcal1" autocomplete="off" checked="checked">rcal1</label>
    <label class="btn btn-primary">
        <input type="radio" name="options" id="rcal2" autocomplete="off">rcal2</label>
    <label class="btn btn-primary">
        <input type="radio" name="options" id="rcal3" autocomplete="off">rcal3</label>
</div>

JavaScript

$(".calsort input").on('change', function () {
    var self = jQuery(this);
    var aResult = self.is(":checked");
    if (aResult) {
        alert(self.attr('id'));
    }
});