JSFiddle - React, Tailwind, and code Playground

by sanford

HTML

<form id="frmButtons">
  <button type="button" data-href="https://0.0.0.0/?1">
    One
  </button>
  <button type="button" data-href="https://0.0.0.0/?2">
    Two
  </button>
  <button type="button" data-href="https://0.0.0.0/?3">
    Three
  </button>
</form>

JavaScript

document.querySelector('#frmButtons').addEventListener('click', function(e) {
  if (e.target.tagName == 'BUTTON') {
    document.location.href = e.target.getAttribute('data-href');
  }
});