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
  • 35,662
  • 8
  • 61
  • 98
GibboK
  • 68,054
  • 134
  • 405
  • 638
  • 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
  • 79,642
  • 23
  • 92
  • 120
0
 var events = $(img).data("events");

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

See a Fiddle

RienNeVaPlu͢s
  • 6,993
  • 6
  • 41
  • 74