JSFiddle - React, Tailwind, and code Playground
HTML
<form method="get" id="myform" action="#">
<input type="text" name="somestring" />
<input type="submit" value="File Bug" name="submit">
</form>
JavaScript
jQuery.fn.preventDoubleSubmission = function() {
var last_clicked, time_since_clicked;
$(this).bind('submit', function(event){
if(last_clicked) {
time_since_clicked = event.timeStamp - last_clicked;
}
last_clicked = event.timeStamp;
if(time_since_clicked < 2000){
console.log("no: "+time_since_clicked);
return false;
}
console.log("si");
return true;
});
};
jQuery("#myform").preventDoubleSubmission();