10

How can each element with a click event found by jQuery (2.2.1)?

This seems to not work anymore:

console.log($._data( $(this)[0], 'events' ))
Keavon
  • 6,837
  • 9
  • 51
  • 79
misterpaul
  • 103
  • 3
  • 2
    We do not have jQuery 2.2.1 yet. – PeterKA Jul 14 '14 at 20:05
  • 2
    The answer to http://stackoverflow.com/questions/1515069/jquery-check-if-event-exists-on-element assumes that what the OP has should, or at least used to work. It has been removed since 1.8 See http://stackoverflow.com/a/1515073/227299 and http://blog.jquery.com/2012/08/09/jquery-1-8-released/ – Ruan Mendes Jul 14 '14 at 20:06
  • @JuanMendes The blog says that getting it with `$(element).data("events")` has been removed, but `$._data(element, "events")` still works. But I wouldn't be surprised if it has changed incompatibly in 2.x. – Barmar Jul 14 '14 at 20:20
  • i trying to find all elements with an event like click or mousedown (set via jquery or vanilla javascript) – misterpaul Jul 14 '14 at 20:24
  • @Barmar It says that a private, for debugging version is (was) still available. It seems pretty likely to me that it has by now been removed also. – Ruan Mendes Jul 14 '14 at 21:53

1 Answers1

1

Try

$.each($("*"), function(index, value) {
    if ($._data($(value)[0], "events") != undefined) {
         console.log($._data($(value)[0], "events")
                     , window.jQuery().jquery); 
    };
});

jsfiddle http://jsfiddle.net/guest271314/3dhMM/

jQuery:

guest271314
  • 1
  • 15
  • 104
  • 177