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,753
  • 72
  • 57
  • 129
hamed
  • 7,939
  • 15
  • 60
  • 114
  • http://stackoverflow.com/questions/2518421/jquery-find-events-handlers-registered-with-an-object – nanndoj Mar 09 '15 at 10:52

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,939
  • 15
  • 60
  • 114