Код: Выделить всё
const one = document.getElementsByClassName('one');
one.forEach((element) => {
element.addEventListener("click", () => {
if (element.style.backgroundColor = "#DCDCDC") {
element.style.backgroundColor = "#56F1FF";
} else {
element.style.backgroundColor = "#DCDCDC";
}
})
});
Код: Выделить всё
.one {
background-color: #DCDCDC;
}
.one:hover {
background-color: #56F1FF;
}
Код: Выделить всё
Catch
Change
Choose
Подробнее здесь: https://stackoverflow.com/questions/791 ... same-class