0

How can I access an elements event handler's with jQuery.

The following link seems to indicate that you could previously access them via $(element).data('events')

Accessing functions bound to event handlers with jQuery

But this method doesn't seem to work anymore.

Community
  • 1
  • 1
Mark Brown
  • 12,026
  • 8
  • 27
  • 32

1 Answers1

1

$(element).data('events') still works for me.

See here in jQ 1.5.2: http://jsfiddle.net/JAAulde/f82Ky/1/

JAAulde
  • 19,250
  • 5
  • 52
  • 63
  • Seems like it depends on how it was bound. – Kevin Ennis Apr 29 '11 at 22:57
  • @kennis Can you elaborate? If you mean it depends on whether `live()` or `delegate()` was used as opposed to `bind()` or one of the bind shortcuts, you're quite right. If you mean something else, I need an explanation. (or perhaps you mean jQ may not have been involved at all? in that case, `data()` would not be of help either) – JAAulde Apr 29 '11 at 23:00
  • 1
    Sorry. I blame my unreasonable brevity on the fact that it's Friday night. I was in fact referring to live() and delegate(). – Kevin Ennis Apr 29 '11 at 23:01
  • Ah, you're right. The events were bound with live, which means they're on the document root. Thanks! – Mark Brown May 03 '11 at 22:40