JSFiddle - React, Tailwind, and code Playground

by Gabriel Esquivel

HTML

<div class="showhide" id="showhide140">140</div>
<div class="showhide" id="showhide141">141</div>
<div class="showhide" id="showhide142">142</div>

<input type="submit" value="+140" id="toggleinfo427" class="toggleinfo-button" data-id="140">
<input type="submit" value="+141" id="toggleinfo427" class="toggleinfo-button" data-id="141">
<input type="submit" value="+142" id="toggleinfo427" class="toggleinfo-button" data-id="142">

CSS

.showhide{
    border: 1px dashed red;
    margin-bottom: 10px;
    height: 20px;
}

JavaScript

$('.toggleinfo-button').click(function(){ 
    var showHideId = 'showhide'+ $(this).data('id');
  $('#'+showHideId ).toggle("fast");
});