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
  • 25,706
  • 67
  • 182
  • 315

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
  • 31,394
  • 10
  • 61
  • 78