:) So I cant figure it out how to addeventlistener to an icon. I have something like that in HTML
<li><button><i class="fas fa-moon"></i></button></li>
aaaand something like that in JS
var nightMode = document.querySelector("button");
nightMode.addEventListener("click", function(){
console.log("it's working");
});
but it's not working. Uncaught TypeError: Cannot read property 'addEventListener' of null Can someone explain me what to do and why ? I also add in css cursor: pointer; for that button :|
` tag.
– T.J. Crowder Aug 13 '18 at 17:07