diff --git a/index.html b/index.html index 53b6a34..77262e5 100644 --- a/index.html +++ b/index.html @@ -17,6 +17,6 @@

You've clicked the lights 0 times

- + \ No newline at end of file diff --git a/script.js b/script.js index 7056c69..b67f1ad 100644 --- a/script.js +++ b/script.js @@ -1 +1,27 @@ -// Write your code here \ No newline at end of file +// Write your code here +let lightbulb1 = document.querySelector("#lightbulb1"); +let lightbulb2 = document.querySelector("#lightbulb2"); +let lightbulb3 = document.querySelector("#lightbulb3"); +let subtitle = document.querySelector(".subtitle"); +count = 0; + +lightbulb1.addEventListener("click", function(event) { + count++; + subtitle.innerHTML = `You've clicked the lights ${count} times`; + this.classList.toggle('active'); + return count; +}) + +lightbulb2.addEventListener("click", function(event) { + count++; + subtitle.innerHTML = `You've clicked the lights ${count} times`; + this.classList.toggle('active'); + return count; +}) + +lightbulb3.addEventListener("click", function(event) { + count++; + subtitle.innerHTML = `You've clicked the lights ${count} times`; + this.classList.toggle('active'); + return count; +}) \ No newline at end of file