I am writing a small practice website. Relevant HTML:
...
<body>
<div id="button">CLICK ME</div>
<script src="assets/js/app.js"></script>
</body>
...
My app.js file has the following code:
document.querySelector("#button").addEventListener("click", new function() {
alert("test");
});
When I reload the page, the event triggers. After that, clicking the div
does nothing. What is causing this issue and how can I fix it?