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. 一些简单的css和js知识

    这几天主要做的是前端网页的调整和页面UI的优化方面的内容.这中间主要是学习了一些基本的HTML和css样式的基本元素的属性.设置行高的line-heght属性,设置窗口的浮动用position属性,设 ...

  2. DiscreteSeekBar---->SeekBar的使用

    build: compile 'org.adw.library:discrete-seekbar:1.0.0' 在布局中的使用: <org.adw.library.widgets.discret ...

  3. MySql中having字句对组记录进行筛选使用说明

    having字句可以让我们筛选成组后的各种数据 having的用法 having字句可以让我们筛选成组后的各种数据,where字句在聚合前先筛选记录,也就是说作用在group by和having字句前 ...

  4. mysql添加用户权限

    MySQL性能调优my.cnf详解 //登录MYSQLmysql -u root -p//创建用户insert into mysql.user(Host,User,Password) values(‘ ...

  5. 简单总结一下NotificationCenter、KVC、KVO、Delegate

    将最近总结的最常用的几种设计模式优势与区别自己小结一下,分享给大家. kvo只能用来对属性作出反应,而不会用来对方法或者动作作出反应,是实现一个对象与另外一个对象保持同步的一种方法,能够提供观察的属性 ...

  6. 导出Unity场景为配置文件

    在处理很多人参与的项目时,很多时候在操作场景时,可能会牵扯到场景修改的冲突问题,这种时候,我们可以将场景以配置文件的形式存储下来(cocos的场景.android的view保存思想),可以采用json ...

  7. android常见错误-Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE

    在andorid进行调试的过程中,出现下面的错误: 解决方法: 修改一下应用程序描述符: <manifest xmlns:android="http://schemas.android ...

  8. FontCombobox 和FontSizeCombobox

    附件:http://files.cnblogs.com/xe2011/WindowsFormsFontCombox.rar 自定义组件字体组合框 自定义组件字体组合框如何使用 自定义组件字体大小组合框 ...

  9. Ebean Demo

    ebean  orm框架,其作者觉得hibernate的bean管理会话管理.难以在短时间明确,就自己搞了一套,就成了如今的ebean. ebean被一些开发人员这觉得是一把瑞士军刀.能够看出一些程序 ...

  10. kernel笔记:TCP参数

    http://blog.chinaunix.net/uid-27119491-id-3346430.html 本文将介绍网络连接建立的过程.收发包流程,以及其中应用层.tcp层.ip层.设备层和驱动层 ...