How to discover the actions an element has when clicked?

Asked

Viewed 153 times

2

I wonder if there is a way to create a script that shows me the actions of a certain element when clicked, or if you want to debug it in the Chrome console, for example.

Something that would tell me for example what function the click calls.

1 answer

3


John, there is! I use the Visual Event 2 which is a bookmarklet that you rotate on the page and it gives a visual reference to which elements in the DOM have events tied. The result is this:

Visual Event 2 - Snap shot

When you hover over the boxes a popup appears with the code to be invoked!

The Chrome console also displays the events of an DOM element, give Inspect element the desired element then cleave into Event Listeners:

Events listeners no console do chrome

For those who use Firebug this feature has been introduced since version 1.12, see the documentation.

If you want to get this information programmatically you can look at the Visual Event source code or this great English response in the original OSenglish

Browser other questions tagged

You are not signed in. Login or sign up in order to post.