From ddb2ac6339cec6deb46ab5613717859f4909e772 Mon Sep 17 00:00:00 2001 From: gennyble Date: Sun, 18 Jun 2023 18:22:20 -0500 Subject: it worksish --- script.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'script.js') 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; -- cgit 1.4.1-3-g733a5