JSFiddle - React, Tailwind, and code Playground

HTML

<button id="btn1" class="actionButtons">cmt1</button>
<button id="btn2" class="actionButtons">cmt2</button>
<div id="cmt1" class="actionDivs" style="display:none">comments1<br/>more comments<br/>and even more</div>
<div id="cmt2" class="actionDivs" style="display:none">comments2<br/>another comment<br/>and another one</div>

JavaScript

for(var  i = 0; i < $(".actionButtons").length; i++){
    $(".actionButtons")[i].onclick = function () {
        for(var j = 0; j < $(".actionDivs").length; j++){
            if ($(".actionDivs")[j].id == this.innerText)
                $("#" + this.innerText).show();
            else
                $("#" + $(".actionDivs")[j].id).hide();
        }
    };
}