JSFiddle - React, Tailwind, and code Playground

HTML

<ul>
               <li id="6"><input type="radio" name="g1"  value="sell" id="sell" />Sell</li>
               <li id="7"><input type="radio" name="g1"  value="rent" id="rent" />Rent</li>
       <li id="8"><input type="radio" name="g1"   value="donate" id="donate" />Donate</li>
             </ul>


            <div id="selltab" style="display:none;">
       eeeeeeeee
    </div>
    <div id="renttab" style="display:none;">
       ffffffffff
    </div>
       <div id="donatetab" style="display:none;">
       ggggggggg
       </div>

JavaScript

$('input[type="radio"]').click(function(){
        
        //Hidding all the divs
         $('input[type="radio"]').each(function(){
               currentID = $(this).attr('id');
               $('#' + currentID  + "tab").hide();
             });
        
        //showing the div respective to radio button clicked
         currentID = $(this).attr('id');
        $('#' + currentID  + "tab").show();
    }
    );