JSFiddle - React, Tailwind, and code Playground
HTML
<form action="javascript:alert('success!');">
<input type="submit"/>
</form>
JavaScript
var submitNow = false; count=0;
$(function() {
// Set up the submit handler
$("form").submit(function() {
setTimeout(function() {
submitNow = true;
$("form").submit();
}, 2000);
// The if else is just for this example,
// so it doesn't go forever. A real
// submit would change the page.
if (count++ == 1) return submitNow;
else return false;
});
});