Loop Queryselectorall
Array.from(document.querySelectorAll(".ClassName")).forEach(function(element) {
//Stuff
});
ayaan
Array.from(document.querySelectorAll(".ClassName")).forEach(function(element) {
//Stuff
});
const cbox = document.querySelectorAll(".box");
for (let i = 0; i < cbox.length; i++) {
cbox[i].addEventListener("click", function() {
cbox[i].classList.toggle("red");
});
}