Debugging JS program is not as easy as we do in Visual Studio or any other IDE. I usually us "alert()" function to add some breakpoints for debugging.

For example:

 var costAdjust = $(e.container).find("input[name='CostAdjustment']").data("kendoNumericTextBox");
costAdjust.value(Number($("#extraMinTotal").html()) * Number($("#extraMinRate").html()));
costAdjust.trigger("change", { value:costAdjust.value() });

If the costAdjust didn't trigger like I expect. I will add a alert try to check if the #extraMinRate got the right value.

 var costAdjust = $(e.container).find("input[name='CostAdjustment']").data("kendoNumericTextBox");
alert($("#extraMinRate").html());
costAdjust.value(Number($("#extraMinTotal").html()) * Number($("#extraMinRate").html()));
costAdjust.trigger("change", { value:costAdjust.value() });

But in this way it will stop your page coding flow and it can't show all the detail if you try to see object's value. Like this:

 var costAdjust = $(e.container).find("input[name='CostAdjustment']").data("kendoNumericTextBox");
alert($("#extraMinRate"));
costAdjust.value(Number($("#extraMinTotal").html()) * Number($("#extraMinRate").html()));
costAdjust.trigger("change", { value:costAdjust.value() });

This time alert will only showing "Object" without any detail:

The better way to show the object detail is using "console.log()" instead of alert.

 var costAdjust = $(e.container).find("input[name='CostAdjustment']").data("kendoNumericTextBox");
console.log($("#extraMinRate"));
costAdjust.value(Number($("#extraMinTotal").html()) * Number($("#extraMinRate").html()));
costAdjust.trigger("change", { value:costAdjust.value() });

You should check your output using chrome browser inspect function (Ctrl + Shift + I). At he Console tab, you will see the object detail.

You can click the little trianggle to find more details of this object. That allows you to trace your code data easierly and your page flow will not be stoped.

<END>

The Better Way to Debug Your JavaScript Program的更多相关文章

  1. Why we made vorlon.js and how to use it to debug your JavaScript remotely

    Vorlon.js is powered by node.JS, socket.io, and late-night coffee. I would like to share with you wh ...

  2. Use GDB to debug a C++ program called from a shell script

    解决了我一个大问题!!! http://stackoverflow.com/questions/5048112/use-gdb-to-debug-a-c-program-called-from-a-s ...

  3. gdb/valgrind/coredump to debug c/cpp program

    gdb/valgrind/coredump 调试 1.gdb 调试 while/for 循环 ①如果在调试 while/for的时候,可以用until xxx(其中,xxx代表 行号)直接跳转到循环后 ...

  4. Using DTrace to Profile and Debug A C++ Program

    http://www.oracle.com/technetwork/server-storage/solaris/dtrace-cc-138561.html

  5. Best JavaScript Tools for Developers

    JavaScript solves multiple purposes; it helps you to create interactive websites, web applications, ...

  6. 【repost】JavaScript Scoping and Hoisting

    JavaScript Scoping and Hoisting Do you know what value will be alerted if the following is executed ...

  7. VS2008 Debug与Release的本质区别(转)

    如何设置:工具栏“生成”→“配置管理器”→“活动解决方案配置” 对于VS2008的初次使用者来说,常会遇到的编译问题时,Debug版本运行正常,但在Release版本则不稳定或无法运行.以下是对Deb ...

  8. Debug与Release的区别

    Debug版本包括调试信息,所以要比Release版本大很多(可能大数百K至数M).至于是否需要DLL支持,主要看你采用的编译选项.如果是基于ATL的,则Debug和Release版本对DLL的要求差 ...

  9. [转]Debug 和 Release 编译方式的区别

    本文主要包含如下内容: 1. Debug 和 Release 编译方式的本质区别 2. 哪些情况下 Release 版会出错 3. 怎样“调试” Release 版的程序 Debug 和 Releas ...

随机推荐

  1. 推荐一款自己的软件作品[豆约翰博客备份专家],新浪博客,QQ空间,CSDN,cnblogs博客备份,导出CHM,PDF(转载)

    推荐一款自己的软件作品[豆约翰博客备份专 豆约翰博客备份专家是完全免费,功能强大的博客备份工具,博客电子书(PDF,CHM和TXT)生成工具,博文离线浏览工具,软件界面美观大方,支持多个主流博客网站( ...

  2. ARM学习笔记10——GNU ARM命令行工具

    一.编译器arm-linux-gcc 1.用arm-linux-gcc编译一个程序,一般它是要经过如下步骤的: 1.1.预处理阶段 编译器把上述代码中stdio.h编译进来,使用GCC的选项-E可以使 ...

  3. EJB (not bound)

    问题: 在代码实在找不到错误的情况下,仍然报:XXXX not bound 问题产生过程: 通过下图方式创建的项目:EJBTest2_1 勾选下面两项,即可生成:EJBTest2_1EJB 和 EJB ...

  4. 斐波那契fib

    输入N和N个数(N<=10,每个数<=10^17),对于每个数,要输出能用几个斐波那契数加加减减得到 样例输入: 35101070 样例输出: 124 直接拷题解: fib[i]表示斐波那 ...

  5. python-面向对象(四)——类成员的访问方式汇总

    类成员的访问方式 #!/usr/bin/env python # _*_coding:utf-8 _*_ class pepole(object): '''This is __doc__ inform ...

  6. 深入理解Objective-C:优化你的代码

    开篇 只要用到Objective-C,我们每天都会跟方法调用打交道.我们都知道Objective-C的方法决议是动态的,但是在底层一个方法究竟是怎么找到的,方法缓存又是怎么运作的却鲜为人知. 本文主要 ...

  7. (转)JS托管和最新的jQuery引用地址大全(jQuery最新版v1.9.0)

    什么是Google的js托管? 说的明白点,跟我们以往做法一样,只不过这时候的引用的js库是放在Google服务器上的.比如引用jquery,则使用路径http://ajax.googleapis.c ...

  8. 利用图片延迟加载来优化页面性能(jQuery)

    图片延迟加载也称懒加载,常用于页面很长,图片很多的页面,以电子商务网站居多,比如大家常上的京东,淘宝,页面以图居多,整个页面少说几百K,多则上兆,如果想一次性加载完成,不仅用户要哭了,服务器也得哭了. ...

  9. C# winform如何在textbox中判断输入的是字母还是数字?

    1.用正规式using System.Text.RegularExpressions; string pattern = @"^\d+(\.\d)?$";if(Text1.Text ...

  10. Android_设备隐私获取,忽略6.0权限管理

    1.前言 (1).由于MIUI等部分国产定制系统也有权限管理,没有相关api,故无法判断用户是否允许获取联系人等隐私.在Android 6.0之后,新增权限管理可以通过官方api判断用户的运行状态: ...