JSFiddle - React, Tailwind, and code Playground

by sc0rp10

HTML

<form action="" class="foo">
  <button type="submit">submit</button>
</form>

JavaScript

document.querySelectorAll(".foo").forEach(function(el) {
  console.log(el)
  el.addEventListener("submit", function(e) {
    e.preventDefault();
    alert(1);
  });
});