// <---notice - no inline onclick funct...">

Find out the registered methods for the OnClick event?

I have a simple input element:

<input class="a" /> // <---notice - no inline onclick function 

someone does

 $(".a").on('click',function () {alert('1')}); // ...and later $(".a").on('click',function () {alert('2')}); 

Now I want to find: "what functions are performed when the element is clicked"?

How can I do this in jquery / javascript?

ps please ignore anonymous functions here, I could also add a regular named function.

jsbin

(im using (as jsbin shows, with 1.8.3 - the last))

+4
source share
2 answers

Try the following:

 console.log($._data( $(".a")[0], "events" )); 

Tested in version 1.8.2

+3
source

There is a way to do this with the current and older versions of jQuery, however it is internal and depreciates and will be gone soon.

 console.log($(".a").data("events")); 
+1
source

All Articles