1

Is there any way to retrieve a list of events of a DOM in Javascript?

e.g. I register FuncA, FuncB, FuncC for the onclick event using AddEvent or AddEventListener methods. How do I get the reference of all these functions for that onclick event?

Ideally, I want to have a function like this:

eventList = getEvents(obj, 'onclick');

and will get the events in an array.

Any idea?

or Any function that I can use to "PAUSE" an event and "RESUME" later? e.g. I want to pause obj.click for a while until something happens, then resume it. I don't want to remove all the events and register them back.
I know there is event stop propagation function, but that one cannot be resumed.

RAS
  • 8,100
  • 16
  • 64
  • 86
Murvinlai
  • 2,276
  • 6
  • 23
  • 34

1 Answers1

3

Create something which hooks into addEvent or addEvent listener and then track it the additions/subtractions. But I wouldn't rewrite this, as jQuery already does it.

Here's the exact same question, but with all the answers:

How to find event listeners on a DOM node when debugging or from the JavaScript code?

(contains three methods of doing what you want)

Community
  • 1
  • 1
cgp
  • 41,026
  • 12
  • 101
  • 131
  • Thanks. Unfortunately, the code I'm working on is not using JQuery framework. It is using MochiKit. So, I'm stuck with looking for the more premitive type of solution. – Murvinlai Apr 24 '09 at 18:59
  • You can still select an answer or drop the question? :) – cgp Apr 24 '09 at 19:01