举个例子来说吧,最近有个活动是做一个在线的能够与客户端互动的纸牌游戏。一个需求是纸牌需要有个onclick haddler在某个特定时间,不过这些事件只针对那些face down(脸朝下)的。作为一个.net的开发者我立刻能够想到的办法是让这些纸牌在客户端通过一个collection来编号.然后我可以在需要的时候给这个数据一个onclick handlers。这个固然可以,不过难以维护且有点凌乱。
现在如果我使用CSS类来实现，face up的纸牌我通过addclass方法为它们加上一个'flipped'类,然后可以通过一个简单的 '$(".card:not(.flipped)")'选择那些face down的纸牌。使用jQuery的click(fn)功能能够让我使用几行代码就实现这个功能。更重要的是它更容易理解和读取。
Coming from the save-compile-reload paradigm of statically typed server-side development, it's natural to approach client-side development in a similar fashion. While you certainly can write client-side code that way, it's akin to working blindfolded when you consider the alternatives.
Whatever your browser of choice, I urge you to give these utilities a try when debugging client-side functionality. Once you become proficient with one of these tools, you'll be amazed that you ever developed client-side code without it.
Even though browser-based tools are great for debugging, an ASP.NET developer's primary editor is still going to be Visual Studio. When writing jQuery code in Visual Studio, having proper Intellisense can make a tremendous difference in productivity. The discoverability that Intellisense provides is especially beneficial when you're unfamiliar with jQuery's API.
As part of the official support for jQuery, Microsoft provides a documentation file to provide jQuery Intellisense inside Visual Studio 2008. This is provided through what's called a vsdoc file, and is available on the jQuery download page (via the “Documentation: Visual Studio” links).