How to find a .js file in which a specific js function is declared (from Chrome)?

For example, if I run some page in Chrome with the following code:

<div onclick="someFunction('test')"></div>

I would like to know which js file contains "someFunction". Is it possible and how? (I suppose this can be done using debugging, but don't know how)

+5
source share
4 answers

In Firefox with a web developer add-in, information / view Javascript / Expand All, find "someFunction".

Of course, there are many other ways to do this, but this add-on puts all the JS from the page in one browser, making it easy to search the entire site.

+5
source

what I'm doing: [Assuming you have access to the source code]

grep -r "function someFunction" . 

. - , . , "function someFunction".

, , , , , :

grep -r "function someFunction" | grep -v "withouth this text"

, ! , , cygwin?

, , , someFunction ...

+1

( → → - ) .

+1

Google , submit (a, b) - , .

submit . . , . .

0
source

All Articles