开发者

Trying to locate function in JavaScript files using Firebug

I'm trying to locate this function call myFooBar() that is referenced inline in some HTML but the page loads tons of JavaScripts and it's quite some work to search that function in each of those files. How can I 开发者_运维知识库locate in which JavaScript file this function lives using Firebug?


  • Open the Script tab.
  • Type your function name in search box at top right of firebug (see spyglass).
  • You can use the next and previous buttons to jump between occurrences of the function.
  • The file name appears in the Script tab's bar, and changes for each occurrence.

By going to the script tab you are only searching js on the page, if you try this in the html or css tabs you will only be searching for occurrences of your entered text within those specific content types.


If you want only to see the source code of the method and know the correct function name. Just execute alert( myFooBar ); on Firebug console.


If you like to see the function definition type the function name in the console. If you want to know which java script file then Right click the inspect element.Select the resource tab.Then put the function name on the search box to search for it.You will see the number of occurrences of that function.Hope this tip will help as well.

But also remember that it is not possible always to find out which java file it was.If you are using smarty in your project then some java script might be inline inside the tpl file

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜