JSFiddle - React, Tailwind, and code Playground

by moogs

HTML

<form id="form">
  <input type="hidden" id="location" name="location" value="" />
  <button type="submit">
    Submit
  </button>
</form>

JavaScript

document.getElementById('location').value = window.location.href;

document.getElementById('form').addEventListener('submit', function(event) {
  event.preventDefault();
  alert(this.location.value);
});