“.addEventListener is not a function” why does this error occur?
The problem with your code is that the your script is executed prior to the html element being available. Because of the that var comment is an empty array. So you should move your script after the html element is available. Also, getElementsByClassName returns html collection, so if you need to add event Listener to … Read more