JSFiddle - React, Tailwind, and code Playground

by David Thomas

HTML

<label class="clickMe" for="textBox1">Show</label>
<div id="textBox1" class="textbox">This text will be toggled</div>
<label class="clickMe" for="textBox2">Show</label>
<div id="textBox2" class="textbox">This text will be toggled</div>

CSS

label, div {
    display: block;
}

div.textbox {
    display: none;
}

JavaScript

$('.clickMe').toggle(
            function(){
                $('#' + $(this).attr('for')).show();
                $(this).text('hide');
            },
            function(){
                $('#' + $(this).attr('for')).hide();
                $(this).text('show');
            });