JSFiddle - React, Tailwind, and code Playground
HTML
<button class='toggler'>Toggle Content</button>
<p aria-hidden='true'>some content to be toggled</p>
CSS
[aria-hidden='true'] {
display: none;
}
JavaScript
$('.toggler').click(function(e) {
e.preventDefault();
$content = $(this).next("p");
$content.attr('aria-hidden', function(index, hiddenState) {
console.log(hiddenState);
var toggleState = (hiddenState === 'true');
return !toggleState;
});
});