JSFiddle - React, Tailwind, and code Playground

by Abhisek DasGupta

HTML

<!doctype html>
<body>
<button data-toggle-id="subscribe-mail">
  Show the subscription form
</button>

<form id="subscribe-mail" hidden>
  Your mail: <input type="email">
</form>

</body>

JavaScript

document.addEventListener('click', function(event) {
    console.log(event);
    let id = event.target.dataset.toggleId;
    if (!id) return;

    let elem = document.getElementById(id);

    elem.hidden = !elem.hidden;
  });