1

I am debugging this code. I would like to know how to see which handler is attached to img.

img.unbind('error').bind('error', function() {
    img.unbind('error').attr('src', 'img/cover-empty.png');
});

I would like print the result using console.log()

George
  • 36,413
  • 9
  • 66
  • 103
GibboK
  • 71,848
  • 143
  • 435
  • 658
  • 2
    Perhaps [this question](http://stackoverflow.com/questions/2518421/jquery-find-events-handlers-registered-with-an-object) could help you? – George May 30 '13 at 09:01

2 Answers2

1

as you have not mentioned the id or class for img

 $.each($("<img selector>").data("events"), function(e, event) {
   $.each(event, function(a, obj) {
    console.log(obj.handler);
 });
});

Working Demo

Milind Anantwar
  • 81,290
  • 25
  • 94
  • 125
0
 var events = $(img).data("events");

 console.log(events); // -> Object { error=[1] }

See a Fiddle

RienNeVaPlu͢s
  • 7,442
  • 6
  • 43
  • 77