Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to show all active jQuery bind()'s?

Is it possible to show all active jQuery bind()'s?

like image 489
Peter Avatar asked Sep 05 '10 14:09

Peter


2 Answers

You can show all data that jQuery elements have referenced with:

console.log(jQuery.cache);  // Logs the entire cache

Or for just the events (for those elements that have them):

for(name in jQuery.cache) {
    if(jQuery.cache[name]['events'])
       console.log(jQuery.cache[name]['events']);
}
like image 70
user113716 Avatar answered Oct 06 '22 01:10

user113716


To do it at runtime using only the browser, use FireQuery: http://firequery.binaryage.com/

With jQuery:

var events = $('#element').data("events");
var firstClickEvent = events.click[0];

You can access all the event handlers like that for the element. To get every single one, you would have to enumerate the events variable.

like image 31
Chris Laplante Avatar answered Oct 06 '22 02:10

Chris Laplante