Ask element for their events


In javascript, is there a way yo as a element for the events that i can use to add listener.

Something like:

element = document.getElementById(id);

Im using a DOM example, but this would be usefull in node.js also.

Problem courtesy of: Siedrix


No, there is no such way of retrieving a list of supported events for an element/object.

In case of Node.js you should read the api documentation:

For HTML elements I would suggest that you search over at MDC, this should be a good starting point:

Solution courtesy of: Ivo Wetzel

View additional discussion.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.