mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 19:03:30 -05:00
Without the `var` prefix this was making `$submitButton` a global variable, which is not what the code intended.
31 lines
501 B
JavaScript
31 lines
501 B
JavaScript
(function() {
|
|
|
|
"use strict";
|
|
|
|
let disableSubmitButtons = function(event) {
|
|
|
|
var $submitButton = $(this).find(':submit');
|
|
|
|
if ($submitButton.data('clicked') == 'true') {
|
|
|
|
event.preventDefault();
|
|
|
|
} else {
|
|
|
|
$submitButton.data('clicked', 'true');
|
|
setTimeout(renableSubmitButton($submitButton), 1500);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
let renableSubmitButton = $submitButton => () => {
|
|
|
|
$submitButton.data('clicked', '');
|
|
|
|
};
|
|
|
|
$('form').on('submit', disableSubmitButtons);
|
|
|
|
})();
|