JSFiddle - React, Tailwind, and code Playground

HTML

<input type="radio" name="my_radio_button" id="radio1" value="ONE" checked />
<input type="radio" name="my_radio_button" id="radio2" value="TWO" />

JavaScript

$.fn.fix_radios = function() {
      function focus() {
        if ( !this.checked ) return;
        if ( !this.was_checked ) {
          $( this ).change();
        }
      }
    
      function change( e ) {
        if ( this.was_checked ) {
          e.stopImmediatePropagation();
          return;
        }
        $( "input[name=" + this.name + "]" ).each( function() {
          this.was_checked = this.checked;
        } );
      }
      return this.focus( focus ).change( change );
    }
    
    $(function() {
      $( "input[type=radio]" ).fix_radios();
      $("input[name='my_radio_button']").change(function(){
        if ($("input[@name='my_radio_button']:checked").val() == 'ONE'){
          alert("do this stuff"); 
        } else {alert("do other stuff"); }
      });
    });