how i solve this button , becouse he isn't work [closed]

5 hours ago 1
ARTICLE AD BOX

The button is not working , becouse the browser do not producing what I wrote, let see the code

let button=document.getElementById("count-el"); button.addEventListener("click", function(){ console.log("hallo world!"); });

Mohamed's user avatar

New contributor

Mohamed is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

2

Assuming you have an element with an ID of count-el, and you expect hallo world to be written to the browser's console, this works fine.

2026-05-15 05:01:31 +00:00

Commented 2 hours ago

^ and the code runs after the button is present in the DOM

2026-05-15 06:46:20 +00:00

Commented 1 hour ago

Read Entire Article