added an event listener to the code at the top was missing from my code