mirror of
https://github.com/Matewoo/tablet-web-survey.git
synced 2026-11-18 13:52:47 +01:00
add timeout to submit button
When pressing the submit button you must wait 1 second to press again.
This commit is contained in:
@@ -17,6 +17,7 @@ document.querySelectorAll('.emoji').forEach(button => {
|
|||||||
results[category] = button.id;
|
results[category] = button.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (Object.keys(results).length > 0) {
|
||||||
fetch('/submit', {
|
fetch('/submit', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
@@ -36,4 +37,11 @@ document.querySelectorAll('.emoji').forEach(button => {
|
|||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error('Error:', error);
|
console.error('Error:', error);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const submitButton = document.getElementById('submit');
|
||||||
|
submitButton.disabled = true;
|
||||||
|
setTimeout(() => {
|
||||||
|
submitButton.disabled = false;
|
||||||
|
}, 1000);
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user