JSFiddle - React, Tailwind, and code Playground
HTML
<input id="i1" type="button" value="one" />
<input id="i2" type="button" value="two" />
<div>
<div id="di1">This is the first one.</div>
<div id="di2">And here we have number two.</div>
</div>
CSS
div div {
display: none;}
JavaScript
$("input").toggle(
function() {
var theId = "#d" + $(this).attr('id');
$(theId).siblings().css('display','none');
$(theId).css('display','inline');
},
function() {
var theId = "#d" + $(this).attr('id');
$(theId).css('display','none');
}
)