3

Here's part of my code:

1  if (document.forms[0]["displayAddress"].value == "true") {
2    if (document.forms[0]["addressPresent"].value == "") {
3      $("#addressDiv").show();
4      document.forms[0]["addressPresent"].value = "true";
5    }
6  }

Why would firebug skip over line 3? - in dubug mode it doesnt even highlight that row, just skips to the next.

edit: to clarify, line 2 evaluates to true and the debugger goes straight to line 4 without executing line 3. I have tried a forced refresh.

update: the first time the page loads this JS works, after the page is reloaded again I get this problem

3 Answers 3

1

Are you sure that the condition

(document.forms[0]["addressPresent"].value == "")

evaluates to true?

If it does and it just jumps to line 4, have you evaluated that it is actually executing line 3? It could be that the debugger in Firebug is skipping it. Have you tried to break on that line?

Try breaking on that line.

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

1 Comment

Sorry I should have explained better. yes the expression evalutes to true, and the debugger skips over line 3 (doesnt highlight) and goes straight to 4 after the if on line 2. Yesline 4 executes and line3 doesnt
1

I've had Firebug act a little wonky with me at times. Usually a complete closing of Firefox and Firebug will fix the problem. If you need a second opinion, try Chrome's debugger.

Comments

1

I gave up on this in the end and re-wrote the whole method. It now works. Something strange was going on.

Comments

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.