Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find JavaScript handler connected to a button's click event [duplicate]

During some code investigating, I found a html submit button like this:

<button class="btn btn-primary">Create new aicraft</button>

I know somewhere there is javascript code that handeles the button click event. How can I find that javascript code?

like image 705
Yotam Salmon Avatar asked Aug 01 '15 21:08

Yotam Salmon


1 Answers

In Firefox:

  1. F12
  2. Find the line you want to inspect
  3. Click on the small ev button at the end of the line (if there is nothing then no JavaScript is linked)
  4. See what is linked to it

In Chrome:

  1. F12
  2. Click on the line you want to inspect
  3. Click on the "Event Listeners" Tab (where you see the styles by default)
  4. There you can see the linked events

In Edge:

  1. F12
  2. Click on the DOM Explorer tab
  3. Click on the line you want to inspect
  4. Click on the "Events" Tab (where you see the styles by default)
  5. There you can see the linked events
like image 193
szoszk Avatar answered Oct 08 '22 22:10

szoszk