Skip to content Skip to sidebar Skip to footer

Html5 Multiple Canvases Event Listener - How To Determine Which Canvas Experienced The Event?

I'm new to JS. I'm not using jQuery, and I have a question. I've created a variable number of canvases on a page, all have an eventlistener like so: for (i=0; i

Solution 1:

function clickReporter(e){
    console.log( this ); // in a eventListener , this point to the element fire the event
    console.log( e.target ); // in fireFox and webkit, e.target point to the element fire the event
}

Solution 2:

I would think evt.target (event.target) would work.


Post a Comment for "Html5 Multiple Canvases Event Listener - How To Determine Which Canvas Experienced The Event?"