I'm trying to call a function through an eventlistener in Javascript, and within the function I have invoked another eventlistener. However on doing this, my second listener is completely ignored. Is there any condition which I need to follow to make this work?
document.getElementById("my_canvas").addEventListener("mouseenter", this.getAttention); //first event listener
getAttention: function(e){
document.addEventListener("onclick", function(){ console.log("Hello World!"); });
Here the "Hello World" is not consoled.
Please help.