JSFiddle - React, Tailwind, and code Playground
HTML
<input type="radio" name="myRadios" onchange="handleChange1();" value="1" /> 1
<input type="radio" name="myRadios" onchange="handleChange2();" value="2" /> 2
JavaScript
$(function() {
$('input:radio[name="myRadios"]').change(function() {
if ($(this).val() == '1') {
alert("You selected the first option and deselected the second one");
} else {
alert("You selected the second option and deselected the first one");
}
});
});