Skip to content

Commit

Permalink
Merge pull request #863 from saggit/signup/double-click
Browse files Browse the repository at this point in the history
fix: prevent signup button double clicked.
  • Loading branch information
kennethjiang authored Jan 19, 2024
2 parents 9d150be + aa73c6e commit d8f7a71
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions frontend/static/js/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,18 @@ $(document).ready(function () {
$('.popover').popover({
container: 'body'
});

jQuery.fn.preventDoubleSubmission = function() {
$(this).on('submit', function(event) {
var $form = $(this);
var $submitButton = $form.find('button[type="submit"]');
$submitButton.prop('disabled', true).addClass('disabled');

setTimeout(function() {
$submitButton.prop('disabled', false).removeClass('disabled');
}, 3000);
});
};

$('#signup_form').preventDoubleSubmission();
});

0 comments on commit d8f7a71

Please sign in to comment.