0

Possible Duplicate:
jQuery find events handlers registered with an object

How can you retrieve all onlick methods added with click()?

Community
  • 1
  • 1
clarkk
  • 27,151
  • 72
  • 200
  • 340

1 Answers1

4

This will return an array of objects:

$(foo).data("events").click

Access the handler member to get the function:

$(foo).data("events").click[0].handler

JSFiddle: http://jsfiddle.net/Q7hdz/


From the docs:

jQuery itself uses the .data() method to save information under the names 'events' and 'handle'...

So Alnitak's warning below may apply.

Dennis
  • 32,200
  • 11
  • 64
  • 79