[ad_1]
Good day everyone,
I am trying to add a simple click event handler to a button on my site. Somehow, my executeOnClick function is not executed.
There is no other javascript.
Can someone help me understand what is happening?
var hideElement = function ()
var toTopElement = document.getElementById("to-top");
console.log("Hello"); // works fine
var executeOnClick = function ()
console.log("Hello"); // won't show on console
toTopElement.addEventListener('click', executeOnClick);
document.addEventListener("DOMContentLoaded", hideElement);
[ad_2]
لینک منبع