5

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?

3 Answers 3

7
  • 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.

Sign up to request clarification or add additional context in comments.

5 Comments

here is a screen shot for what you are talking about: screencast.com/t/iobUP1zXYFQ
@Amr ElGarhy Thank you kindly, an excellent addition. I switched to Chrome a few months back and can't bring myself to start up FF anymore, it just takes to long with all the development plugins.
I moved also to chrome, but can't stop opening FF because one reason -> FireBug, there is nothing in Chrome as firebug.
@Amr ElGarhy if you get used to webkit inspector it actually provides all the same functionality and in some cases, I've actually found it better. Firebug struggles with heavy js use and I've had it bring down FF. Webkit inspector has never had a problem. Inspector also provides auto complete in its console and some good profiling tools to look at CPU and Network use.
Yes, you are right, it is a good tool and I used it for sometime, but I always feel better and faster while using firebug, specially while debugging javascript code, or editing html, plus the CSS viewing in firebug is better from my point of view, but I know it is just my point of view and doesn't mean that this is better than that, both have pros and cons.
2

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.

Comments

0

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.