JSFiddle - React, Tailwind, and code Playground

HTML

<div id="linkwrapper">
<a id="link1" href="#">link1</a><br/>
<a id="link2" href="#">link2</a><br/>
<a id="link3" href="#">link3</a>
</div>

<div id="infocontent">
    <div id="link1content">Information about 1.</div>
    <div id="link2content">Information about 2.</div>
    <div id="link3content">Information about 3.</div>
</div>

JavaScript

$(document).ready(function(){

    $('#infocontent').children().hide();
        
    $('#linkwrapper a').click(function(){
        
        var chosen1 = this.id;
        
        $('#infocontent').children('div').each(function(i) {
            var i = i+1;
            if( $("#" + this.id).is(":visible") == true ) {
                $("#" + this.id).hide(function(){
                    $("#" + chosen1 + "content").show();
                });
                return false;
                
            } else {
            $("#" + this.id).show();
            return false;
            }
        });
    });
});