views:

303

answers:

3

hi im itrying to debug javascript using vs2010

but i can't set breakpoints?

how can i do this? thanks

edit: ive used your tips, debugger etc... thanks guys. wow! i just noticed something, every time i try to call a function, no matter what function, in javascript, somehow jquery and ms ajax framework javascript captures it and checks if the document is ready (document.onready or other) and never returns the control back to the function im calling! why on earth is it doing this? i've never asked for it to!!!

all i have is references to these libraries, script/link references as you do on the top of your master page.

thsi is ridiculous, anyone have any ideas?

A: 

use

debugger;

statement before the line where you want to stop execution and debug.

var test = "testString";
debugger; // stops execution and can start debugging
test += "newly added"; 
rahul
thanks. check out my edit
Erx_VB.NExT.Coder
+1  A: 

If your script is in a separate script file (.js), then you can just use F9 to set a breakpoint on a line.

You can't set a breakpoint if the script is incorporated in another file like an aspx file. For cases like that, use the debugger; javascript statement to force a break at a certain spot.

Also make sure that you are working with the latest version of your javascript file, do a Ctrl-F5 in IE if necessary to force a fresh reload of the file.

kime waza
check out my edit
Erx_VB.NExT.Coder
A: 

If you're attaching to a process, you can specify that you want to attach to script in the dialog that comes up. But then it'll be only script and not managed code

Why not just use firebug in firefox ?

David Archer
thanks. check out my edit.
Erx_VB.NExT.Coder