JSFiddle - React, Tailwind, and code Playground
HTML
<div id="fold">
<p id="fold_p">Fold it</p>
</div>
JavaScript
jQuery ("#fold") .click (function () {
if (jQuery (this).children ("#fold_p").text() == "Fold it") {
jQuery (this).children ("#fold_p").text("Expand It");
}
else {
jQuery (this).children ("#fold_p").text("Fold it");
}
});