diff options
Diffstat (limited to 'script.js')
-rw-r--r-- | script.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/script.js b/script.js index ea4bd12..54a5151 100644 --- a/script.js +++ b/script.js @@ -22,6 +22,9 @@ class Wednesdayle { this.enter = document.getElementById('enter'); this.enter.addEventListener('click', this.submit.bind(this)); + this.resetBtn = document.getElementById('reset'); + this.resetBtn.addEventListener('click', this.reset.bind(this)); + this.dropdown = document.getElementById('dropdown'); document.getElementById('close-dropdown').addEventListener('click', this.closeDropdown.bind(this)); @@ -66,15 +69,30 @@ class Wednesdayle { for (let i = 0; i < this.boxes.length; ++i) { if (word[i].toUpperCase() != this.boxes[i].innerText.toUpperCase()) { this.notword.style.display = "block"; + this.resetBtn.style.display = "block"; this.active = false; return; } } this.theword.style.display = "block"; + this.resetBtn.style.display = "block"; this.active = false; } + reset() { + console.log("sfa"); + this.active = true; + for (let i = 0; i < this.boxes.length; ++i) { + this.boxes[i].innerText = ''; + } + this.nextBox = 0; + + this.theword.style.display = "none"; + this.notword.style.display = "none"; + this.resetBtn.style.display = "none"; + } + buttonPush(event) { if (!this.active) { return; |