Tuesday, March 3, 2015

debug javascript in Visual studio


http://forums.asp.net/t/1607440.aspx

Re: Debugging Javascript VS 2010 BreakPoints

Sep 29, 2010 01:05 PM|LINK
Best way to debug is using debugger; keyword. Simply add this keyword wherver you want to debug the script and run the application in debug mode
it also works in JS files
check below
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Untitled Page</title>
    <script type="text/javascript">
        function GetDimensions() {
            debugger;
            var txt = document.getElementById("<%=TextBox1.ClientID %>");
            alert("height " + txt.style.height);
            alert("width " + txt.style.width);
        }
    </script>
</head>
<body>
    <form runat="server">
    <asp:TextBox ID="TextBox1" runat="server" Height = "10" Width = "150"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick = "return GetDimensions()" />
    </form>
</body>
</html>

No comments:

Post a Comment