This commit is contained in:
@@ -72,6 +72,31 @@
|
||||
</main>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
const SETTINGS = {
|
||||
countdown: 5, // Countdown in Sekunden
|
||||
};
|
||||
|
||||
const button = document.querySelector('.button-send');
|
||||
const buttonText = button.textContent;
|
||||
|
||||
const buttonCountdown = (countdown) => {
|
||||
if (countdown === 0) {
|
||||
button.textContent = buttonText;
|
||||
button.disabled = false;
|
||||
} else {
|
||||
button.textContent = `${countdown}...`;
|
||||
|
||||
setTimeout(() => buttonCountdown(--countdown), 1000);
|
||||
//
|
||||
}
|
||||
};
|
||||
|
||||
button.addEventListener('click', () => {
|
||||
button.disabled = true;
|
||||
|
||||
buttonCountdown(SETTINGS.countdown);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user