[Fix] Prevent clicking of signup button repeatedly
This commit is contained in:
parent
8020e8dcd0
commit
d2ed1a6007
1 changed files with 15 additions and 0 deletions
|
@ -60,6 +60,21 @@ function checkUsernameAvailability() {
|
|||
}
|
||||
};
|
||||
xhr.send();
|
||||
// Disable the button to prevent multiple clicks
|
||||
submitBtn.disabled = true;
|
||||
|
||||
// Show the spinner
|
||||
const spinner = document.createElement('i');
|
||||
spinner.classList.add('fas', 'fa-spinner', 'fa-spin');
|
||||
submitBtn.innerHTML = '';
|
||||
submitBtn.appendChild(spinner);
|
||||
|
||||
// Enable the button and remove the spinner after 5 seconds
|
||||
setTimeout(function () {
|
||||
submitBtn.disabled = false;
|
||||
submitBtn.innerHTML = 'Sign Up';
|
||||
}, 5000);
|
||||
sleep(5000).then(() => { submitBtn.disabled = false; });
|
||||
}
|
||||
|
||||
function sleep(ms) {
|
||||
|
|
Loading…
Reference in a new issue