forked from MultiverseLearningProducts/Lightbulb-Selectors
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
23 lines (20 loc) · 720 Bytes
/
script.js
File metadata and controls
23 lines (20 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
let bulb1 = document.querySelector("#lightbulb1");
let bulb2 = document.querySelector("#lightbulb2");
let bulb3 = document.querySelector("#lightbulb3");
let subtitle = document.querySelector(".subtitle");
let count = 0;
bulb1.addEventListener("click",function(){
count++;
subtitle.innerHTML = `You've clicked the lights ${count} times`;
this.classList.toggle("active");
});
bulb2.addEventListener("click",function(){
count++;
subtitle.innerHTML = `You've clicked the lights ${count} times`;
this.classList.toggle("active");
});
bulb3.addEventListener("click",function(){
count++;
subtitle.innerHTML = `You've clicked the lights ${count} times`;
this.classList.toggle("active");
});