DEV Community

Discussion on: HELP on JS! alert box wont appear in browser

nbilyk profile image
Nicholas Bilyk • Edited on

getElementsByClassName - note the plural, this will return a node list, not a single element to add an event listener to.

You probably want getElementById and set the id on the html element instead of the class