javascript - Is it possible to listen to all events triggered on an element -


is possible listen events triggered on dom element no matter name of event? , if possible there reason 1 should no that?

unfortunately not able find in either stackoverflow or google :(

i planning write script needs respond 2 dozens different custom events , wondering if, instead of binding each event element listen of them , based on event name, dynamically call function..

you can't in way you've suggested simple alternative:

const events = 'click mouseover mouseout';  events.split(' ').foreach(e => window.addeventlistener(e, dostuff));  function dostuff(){...} 

Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -