Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find elements with click event

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' ))
like image 678
misterpaul Avatar asked Jul 14 '14 20:07

misterpaul


People also ask

How do I get the clicked element in an event?

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.

How do I know if my element is clicked?

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.

What is the difference between .on click function ()) and .click function?

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.


1 Answers

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

  • date: 2014-07-14T09:04Z
like image 150
guest271314 Avatar answered Oct 08 '22 00:10

guest271314