简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM