In this, I’m using VS.Net 2013. As you know, you can easily debug with VS, but did you know you can debug your Javascript/JQuery also?
In the image below, see that all you need to do is add the line:
debugger; (red arrow)
This will start debugging in your script. Just comment it out or remove it when you’re finished debugging. You only can enter your break points in the dynamic file that appears when the code stops at the debugger line. However, in VS.Net 2013, if all your JavaScript is in a separate page, this is not necessary. You can put break points directly in your Javascript code.
Also, notice (blue arrow) that, just as in C#/VB.Net, as you are debugging, you can hover over a variable to get its value. Then, notice the ‘pin’ icon on the far right. While that variable allocation is visible, click on the pin, and it will pin it to your code window (moveable). That way, it’s a ‘watch’ but you don’t have to move your eyes down to or open the watch window. It stays there between coding sessions so it will be there the next time you open that file.
All Things DotNet Discussed – Winforms/ASP.Net/SharePoint/WPF
Leave a reply
You must be logged in to post a comment.