JSFiddle - React, Tailwind, and code Playground

HTML

<fieldset>
  <legend class='togvis'>Click Me</legend>
  <p>I toggle when the legend is clicked.</p>
  <p>But I'm a recalcitrant text node and refuse to toggle.</p>
</fieldset>

JavaScript

$(function(){
    
    $('legend.togvis').click(function() {
    $(this).parents("fieldset").find("*:not('legend')").toggle();
    return false;
});
    
});