Listen for all events in JavaScript -


i'm trying figure out how listen events on javascript object.

i know can add individual events this

element.addeventlistener("click", myfunction); element.addeventlistener("mouseover", myfunction); ... 

i'm trying figure out if there catch-all, i'd this:

// begin pseudocode var myobj = document.getelementbyid('someid');  myobj.addeventlistener(/*catch all*/, myfunction);  function myfunction() {   alert(/*event name*/); } // end pseudocode 

to pick standard element's events.

var myobj = document.getelementbyid('someid'); for(var key in myobj){     if(key.search('on') === 0) {        myobj.addeventlistener(key.slice(2), myfunction)     } } 

but @jeremywoertink mentioned other events possible.


Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -