Event listener not logging anything while detecting clicks and alerting with no prolem.
Tried everything, button clicks register, the JS file is loaded and does console.log when its out of Event listener but soon as i want to log "button clicked" it just doesnt do it
edit: it seems to run perfectly fine on MS edge but chrome doesnt, can it be cause from my extensions? i think its CRX emulator or sth
<!-- HTML --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Event Listeners</title> <script src="script.js" defer></script> </head> <body> <button id="btn">Button</button> </body> </html>
//JS
console.log("JS file loaded")
const btn = document.getElementById("btn"); btn.addEventListener("click", (event) => { console.log("button clicked!") console.log(event.bubbles) })
code: