JSFiddle - React, Tailwind, and code Playground
HTML
<div id="divd">
<div id="div1" onclick="hideAndShow();">One</div>
<div id="div2" onclick="hideAndShow();">Two</div>
<div id="div3" onclick="hideAndShow();">Three</div>
</div>
<div id="texts">
<div id="txt1">Text One</div>
<div id="txt2">Text Two</div>
<div id="txt3">Text Three</div>
</div>
JavaScript
$( "#texts" ).children().hide();
function hideAndShow( toShowSel ) {
$( "#texts" ).children().hide();
$( toShowSel ).fadeIn();
}
$( "#divd" ).click( function(){
hideAndShow( "id" );
});