You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
626 B
22 lines
626 B
const toggles = document.querySelectorAll('.toggle')
|
|
const good = document.querySelector('#good')
|
|
const cheap = document.querySelector('#cheap')
|
|
const fast = document.querySelector('#fast')
|
|
|
|
toggles.forEach(toggle => toggle.addEventListener('change', (e) => doTheTrick(e.target)))
|
|
|
|
function 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
|
|
}
|
|
}
|
|
} |