Why is the 'click' not invoked?
$elemento.addEventListener('click', click, true);
var click = () => { ... };
Why is the 'click' not invoked?
$elemento.addEventListener('click', click, true);
var click = () => { ... };
You must declare the variable with your function before attempting to use it ...
document.addEventListener('DOMContentLoaded', function() {
var click = () => {
alert("Clicou");
};
document.getElementById("test").addEventListener("click", click, true);
}, false);
<input type="button" value="test" id="test">