0

I'm using a jQuery plugin in my application and now I need to develop this plugin for my need. At this time, I want to know For example which function call on clicking some buttons. For example, suppose the plugin had produced a <button id="test">Test</button>. I want to catch function that call on click on this button. Is there any way or tools for doing that?

Update:

Based on nanndoj suggested link, probably jQuery._data( elem, "events" ); can solve my problem. But how can I use that method?

Brian Tompsett - 汤莱恩
  • 5,438
  • 68
  • 55
  • 126
hamed
  • 7,681
  • 13
  • 50
  • 104

1 Answers1

1

I tried this and solved my problem:

$.each($._data($("#elementID")[0], "events"), function(i, event) {
      console.log(i);
      $.each(event, function(j, h) {
           console.log(h.handler);
      });
});

Here is the fiddle link that helped me: http://jsfiddle.net/9n6gh/.

So many thanks to nanndoj for his help.

hamed
  • 7,681
  • 13
  • 50
  • 104