-
-
Notifications
You must be signed in to change notification settings - Fork 678
Expand file tree
/
Copy pathscript.js
More file actions
16 lines (14 loc) · 558 Bytes
/
script.js
File metadata and controls
16 lines (14 loc) · 558 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const toggles = document.querySelectorAll(".toggle");
const good = document.getElementById("good");
const cheap = document.getElementById("cheap");
const fast = document.getElementById("fast");
const doTheTrick = (theClickedOne) => {
if (good.checked && cheap.checked && fast.checked) {
if (good === theClickedOne) fast.checked = false;
if (cheap === theClickedOne) good.checked = false;
if (fast === theClickedOne) cheap.checked = false;
}
};
toggles.forEach((toggle) =>
toggle.addEventListener("change", (e) => doTheTrick(e.target))
);