JSFiddle - React, Tailwind, and code Playground

by BramVanroy

HTML

<h3 id="review">
   <span class="right-box"><a id="pm" href="#">Uitklappen</a></span>
</h3>

<div id="topicreview">
andere html code hier
</div>

CSS

div#topicreview {display: none;}

JavaScript

$(document).ready(function() {
    function toggleAndChangeText() {
        $("#topicreview").toggle();
        if ($("#topicreview").is(":hidden")) {
            $("a#pm").html("Uitklappen");
        }
        else {
            $("a#pm").html("Inklappen");
        }
    }

    $("h3#review > span.right-box > a#pm").click(function(e) {
        toggleAndChangeText();
        e.preventDefault();
    });
});