views:

434

answers:

4

When my javascript code is contained in a HEAD block in my HTML file, it seems I can't set a breakpoint on it to debug it.

How can I do this?

alt text

this is what I see under the script tag:

alt text

alt text

alt text

Odd: when I take the javascript block OUT of my HTML <head> area, then the .htm page appears under scripts (kind of counter-productive):

alt text

ok, the only solution I can find to this question is to put my HEAD scripts back into a .js file, anyone have a way to debug inline javascript?

A: 

You should search for your code in the Script tab, you can't set breakpoints in the HTML tab.

alt text

Edit: In your second screenshot, you are looking the code of the Google JS API file, you can either, change the file manually (the red square at left on my screenshot), or use the search-box at the right:

firebug search

CMS
i normally debug on .js files, and that is how I do it, but now I've got javascript in an html file and can't find my inline textblock under script, screenshot above.
Edward Tanguay
I search for "fadeIn" in the search box and it can't find it
Edward Tanguay
your screenshot is helpful but I'm not finding "dom.js" anywhere under script or on the main firebug header line, something I need to do to get that to appear?
Edward Tanguay
A: 

I don't think you can set breakpoints from the "HTML" tab in firebug.

Click over to the "script" tab, and find your script in the lower dropdown list, and you should be able to set a breakpoint from there.

womp
under the script tag I see "all" and "jsapi", under those I don't see "dom.js" or anything that contains my code, searching for "fadeIn" in the searchbox on the right doesn't find my code
Edward Tanguay
A: 

Enclose your functions in javascript with

debugger;
function blah
debugger;
CodeToGlory
thanks but that didn't seem to bring it up anywhere I can find it
Edward Tanguay
+1  A: 

I found the problem.

instead of:

if($(this).next().is(':hidden')) { 

I had:

if($(this).next().is(':hidden') { 

i.e. the missing end-parenthesis was causing the javascript file (or .htm page including the javascript) not to show up under firebug "scripts".

Edward Tanguay