0

Sometimes I can set breakpoints in my javascript, sometimes I can't - why is this? I can't seem to find whatever it is that would determine whether I can debug it or not. I know I can debug the dynamic page, but occasionally I'll be able to set breakpoints in my original code.

2 Answers 2

3

You can use following to debug javaScript

  • Put breakpoint inside javascript. Using VS2010 you can debug the javascript. You will need to enable javascript debugging in IE by unchecking both of the Disable script debugging from IE => Options => Advanced.
  • Use console.log to log the messages from javaScript

Hope this info helps you.

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

6 Comments

Thanks for your reply Amar. My question is more specific to visual studio though I feel - I simply cannot set a breakpoint anywhere in the javascript (clicking does nothing) on occasions, and then at other times I can set breakpoints without a problem!? Thanks.
Not sure about this but, in such cases try putting breakpoint keyword in the javascript. I have never faced such issue so far (lucky me).
I've had a quick look around and using the debugger keyword will do me for now. Thanks Amar.
Great some break through finally.
what about while using Safari and Firefox and Chrome?
|
1

Try this:

--javascript code......

debugger; // stops execution and can start debugging

--javascript code......

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.