Umotolearnjavascript•Self Learning: Harry tries this code to toggle a CSS class when a button is clicked, but it doesn’t work. Why?
3·
3 years agoWell, you can reuse the reference to your button.
button.addEventListener('click', function () {
button.classList.toggle('clicked')
})
But I’m not sure that this is the expectet answer. I also don’t understand why event.target should be discouraged.
Nice MS Paint skills