About This Script
- Add the code from below to the <head> section of your web page.
- Add the 'preventDuplicate' class to your form(s) like this:
<form action="#" class="preventDuplicate">
Demo
Code
<!-- jQuery is required if you're not already using it -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(function(){
$('form.preventDuplicate').each(function(){
$(this).on('submit', function() {
$(this).find('input[type=submit], button').attr('disabled', 'disabled');
$(this).off('submit');
$(this).on('submit', function(){
return false;
})
});
});
});
</script>
More scripts