Javascript: Check an element’s value change not made by user 18 July 2014 Jeff JavaScript Problem: We all know if an input’s value was changed by user input, we can capture this change event by $('input').change(function(event){ console.log('user changed the value.'); }); But if t... [More]
JS: Lock form when submitting and unlock it when done 14 July 2014 Jeff JavaScript Background: When a form is submitting, it should be locked – not be editable, all input elements and buttons should be disabled. And it should be unlocked or enabled after the submitting is complete ... [More]
Solved: Knockout binding error “Expected identifier, string or number” on IE 8 27 June 2014 Jeff JavaScript Problem: You use Knockout 3.0 in your web pages, and it works fine with all browsers but IE 8. On IE 8, it throws the error: Expected identifier, string or number which is useless for debugging. ... [More]
[Solved] SyntaxHighlighter issues after upgrading BlogEngine.NET from 2.6 to 2.7 21 April 2014 Jeff BlogEngine.NET, JavaScript Problem: I updated my BlogEngine.NET from 2.6 to 2.7, and everything goes well. But one day I found that the syntax highlighter were functioning horribly poor. They are: Js error thrown on every ... [More]
[Solved] Uncaught Error: Can’t find closing comment tag to match: ko if: ***. 17 April 2014 Jeff JavaScript Background: I spent a lot of time to debug this knockout js error as the title shows, and finally I found the cause which made me kind of angry because it was not worth wasting so much time on it. L... [More]
Replace Telerik window with jquery-ui dialog 28 February 2014 Jeff ASP.NET, C#, JavaScript When you need to display some information via pop up window, it's better to use jquery-ui dialog than Telerik window. Not only because the Telerik is not supported any more, but also because the jquer... [More]
将小数转化为分数的算法 21 January 2014 Jeff Math 数学, Programming 编程, JavaScript 问题: 对于一个分数,使用除法就能够得到其小数表示。如: 2/3 = 0.666666… 一般计算器都支持将分数转化成小数的计算模式。但是反过来,拿到一个小数,怎么得到其分数的表示形式呢?似乎没有像除法这样直接的算法,而且一般的计算器和计算程序都没有将分数转化成小数的模式。 比如,拿到一个小数:0.571428571428…,怎么知道它等于4/7? 分析: 小数可分为以下几种: ... [More]
Javascript implementation of String.format() 31 July 2013 Jeff JavaScript Background: The String class has a format() method in C# which is very handy to build dynamic messages from a template. For example, Console.WriteLine(String.Format("Current Page Index: {0}, ... [More]
A navigation control plugin for Flot 23 July 2013 Jeff JavaScript Background: Flot is an open source javascript library for drawing attractive charts, and there is a plugin named jquery.flot.navigation.js to allow user to pan or zoom the charts. However, it is hard... [More]
A Flot plugin for saving canvas image to local disk 02 July 2013 Jeff JavaScript Background: Flot is an open source javascript library to draw attractive charts. I’ve made a plug in for it to allow user save the beautiful chart as an image to local disk as png/bmp/jpeg files by m... [More]