Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome Developer Tools : How to know the event triggered when click a element?

When i'm in any website, how can i use Chrome Developer Tools to find out what JS function is called when i click on an element ?

For instance, i'm on a website that has a DIV element. When i click on this DIV, it will do some actions. I want to know what JS function do these actions, so i am able to call this JS function programatically in the console, without need to manually click on the DIV.

Thanks !

like image 416
delphirules Avatar asked Feb 05 '16 16:02

delphirules


1 Answers

All the event listeners for an element are shown in the Event Listeners panel. If you expand the 'click' event section you'll see what scripts are at play.

Once you've found a likely script, expand its object to see function names (except, of course, for anonymous functions) and other properties.

like image 165
isherwood Avatar answered Oct 23 '22 19:10

isherwood