Support us .Net Basics C# SQL ASP.NET Aarvi MVC Slides C# Programs Subscribe Download

How to debug javascript in visual studio

Suggested Videos
Part 1 - What is the use of JavaScript in ASP.NET
Part 2 - Why do we need both client side and server side validation
Part 3 - Disadvantages of JavaScript

In this video we will discuss, How to debug JavaScript in Visual Studio

Here are the steps
1. In Visual Studio, right click on a web form and select "Browse With..." option from the context menu
debugging javascript in visual studio

2. In the "Browse With" window, 
    a) select "Internet Explorer"
    b) Click "Set as Default" button
    c) Finally click "Browse" button

debugging javascript

3. In Visual Studio, throw a break point on the JavaScript function that you want to debug

4. Run the application in Debug mode

At this point, in the internet explorer perform the action (i.e clicking on button or changing a selection in the DropDownList) that calls the JavaScript function. The JavaScript execution should stop at the breakpoint and we should be able to step over and step into code using F10 and F11 keys respectively.

At this point we should also be able to use watch, quick watch and immediate windows in visual studio.

This approach will not work in visual studio 2008, if you are using any other browser apart from Internet Explorer.

JavaScript tutorial

No comments:

Post a Comment

It would be great if you can help share these free resources