.NET Tip of The Day
Learn one new .NET trick every day
Login or Join
.NET Tips & Tricks Community RSS

Those who prefer reading this site through RSS now can also subscribe for updates to .NET Tips & Tricks Community.

How to debug a JavaScript code

Method 1. Open .js file in Visual Studio and insert breakpoint at the line you want to debug. Open Attach to Process dialog window (menu item Debug | Attach to Process...) and attach to Internet Explorer process (iexplore.exe). Execute the code you want to debug in Internet Explorer.

Method 2. Write your JavaScript and place the debugger keyword where ever you want the code to break into debugging. The JavaScript interpreter hits this keyword and halts execution and returns the control back to the IDE. This is like setting a breakpoint inside of Visual Studio.

Note: you must enable script debugging in Internet Explorer to be able to debug. Go to Internet Options inside Internet Explorer and then go to the Advanced tab. Uncheck Disable script debugging (Internet Explorer).

Enable JavaScript Debugging
7/15/2007
RSS .NET Tip of The Day
Subscribe to receive one tip from the .NET Tips and Tricks Community per day.
Previous Tips of The Day
The best of the .NET Tips & Tricks Community.
.NET Practitioners .NET Tips & Tricks Community
Every .NET practitioner has a trick up in their sleeve. This is the place to share it with other .NET people.
Submit a Tip
Discovered a new trick? Share it with others.
My Tips
Manage tips you authored.