AddEventListener ClassList Toggle Dom
const span = document.querySelector("span");
const classes = span.classList;
span.addEventListener('click', function() {
const result = classes.toggle("c");
if (result) {
span.textContent = `'c' added; classList is now "${classes}".`;
} else {
span.textContent = `'c' removed; classList is now "${classes}".`;
}
})
Angry Alligator