JSFiddle - React, Tailwind, and code Playground

by Nicolas PUJOL

HTML

<span id="btn"><button id="btnEvt">Afficher</button></span>
<div id="cache">
    dsqdqsdqsdqsd sqdqdsqd
</div>

CSS

#cache {
    display: none;
}

JavaScript

$("#btnEvt").on("click", function() {
    $(this).text(function(i, text) {
        return text === "Cacher" ? "Afficher" : "Cacher";
    });
    $('#cache').toggle();
});