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' ))
To get the clicked element, use target property on the event object. Use the id property on the event. target object to get an ID of the clicked element.
To check if an element was clicked, add a click event listener to the element, e.g. button. addEventListener('click', function handleClick() {}) . The click event is dispatched every time the element is clicked. Here is the HTML for the examples in this article.
on('click') event in jquery . on('click') is different from . click(), there it has the capacity to create delegated event handlers by passing a selector parameter, while . click() does not.
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:
version: v2.1.2-pre e5190982c40d7ac8ab9bdb2e7e4334f0e123ef66
url: http://code.jquery.com/jquery-git2.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With