How can I see the event that is attached to an html element?

Vaso A. picture Vaso A. · Aug 6, 2012 · Viewed 15.3k times · Source

Hello I am a new programmer and still learning. This is the code that I am trying to figure out:

<div id="buy" class="buy button">Buy</div>

When I click on the div (button), some javascript code is executed but I don't know were it is. How can I tell what function is fired when click happens? Some how a listener is attached to this element

Answer

yoelp picture yoelp · Aug 6, 2012

In Google chrome's developer tools (click the wrench icon >Tools>Developer tools), select the element in the Elements tab, on the right open the 'Event Listeners' panel you'll will see all events