1

The problem is that I have a huge Javascript code, it's broken down into many files.
And I can't seem to find where a particular javascript code is .

How would you go about finding if you were in my place?

I have the firebug lite installed but no clue how to use it. Thank you.

P.S. I'm not able to comment on SO for some reason. Sorry.

4
  • 1
    grep is handy. Also, most IDEs/advanced programming editors will have a "find in files/project". Commented May 21, 2011 at 7:24
  • Do you know the exact function name? Commented May 21, 2011 at 7:25
  • No it's not a function. It's a jquery thing. Commented May 21, 2011 at 10:53
  • It was the CSS causing the hover action ! When did CSS get so much power ! Commented May 21, 2011 at 12:05

4 Answers 4

6

Check out this link, specifically these headlines:

Find scripts easily

Many web applications are comprised of quite a number of files, and finding the one you want to debug can be a chore. Firebug's script file chooser sorts and organizes files into very clean list that will help you find any file in a snap.

Go directly to line 108, do not pass go

Often times you want to jump directly to a specific line of your script. Doing this couldn't be easier, just type the line number into the quick search box, preceded by the pound sign, as seen in the screen shot on the right.

Find scripts: enter image description here Search scripts: enter image description here

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

1 Comment

great answer - great software
0

I would use a text editor with a Find In Files option like Notepad++. Most IDEs would also provide this search option.

Find in Files

5 Comments

This will not help if the script is loaded from an external server
@Simeon Firebug won't help either if we're using server-side JavaScript. As for the two down votes, please explain why. :)
There is no SSJS or serverside-javascript tag attached to the question. However, the Firebug tag is attached.
@Simeon Firebug helps me debug. When programming, I don't save files through firebug. Those are two different contexts and I simply provided an answer that is less dependent on a firebug and more integrated toward producing code. Why not downvote grep answers because they're not related to firebug? I don't believe that answers should be dependent wholly on tags when there viable alternatives available; otherwise, why bother having multiple answers on SO in the first place?
I downvoted your answer because of two things: 1) It is useless when you don't have the files accessible locally. Which is a common use case for web developers. 2) The question was tagged firebug and can thus be answered in a more useful way than described in 1). If you disagree with that, then so be it. But I am using my right to downvote an SO answer that I find insufficient.
0

there's always: grep -r 'function myHardtoFindFunction(' src/

on a unix system or another system with GNU utilities.

Comments

0

you can search for function names in the firebug search box, which will also search across multiple js files

just open firebug and on the right hand side should be a searchbox. there are even check boxes for searching multiple files, case insensitivity and the use of regex if you feel ambitious.

2 Comments

hmm I thought "firebug search box" was sufficient, but @Simeon has a nice picture of it
It was the CSS causing the hover action ! When did CSS get so much power !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.