JSFiddle - React, Tailwind, and code Playground
HTML
<form action="http://some.html" method="post">
<input type=text>
<input type=submit value=submit>
</form>
JavaScript
$(function() {
var theForm = document.querySelector("form");
theForm.addEventListener("submit",function(evt) {
// First, cancel the form's submission:
evt.preventDefault();
evt.stopPropagation();
console.log("Navitve Submit Cancelled")
if (theForm.checkValidity()) {
// Then, only if it's valid, submit
console.log("Manual Submit Triggered");
theForm.submit();
}
});
});