HTML and CSS Reference
but you often need to write too much code. For example, if you wish to write a client script that shows a
available, and jQuery is one of them. There are others, such as MooTools, Prototype, and Dojo. The fact
that Microsoft uses jQuery extensively in ASP.NET projects clearly indicates jQuery's popularity and
Microsoft's intention to support it in ASP.NET. As you would expect, jQuery is cross-browser and supports
all leading browsers including Internet Explorer, Firefox, Chrome, Opera, and Safari.
jQuery Is Fast and Concise
jQuery is highly optimized library. Moreover, it's compact. The production version of jQuery 1.7.2 is just
32KB, and the development version is 247KB. This compactness means less data to be downloaded on the
client side without compromising stunning UI effects.
jQuery Simplifies Traversing HTML Documents,
Event Handling, Animation, and Ajax Interactions
jQuery simplifies HTML DOM navigation and manipulation considerably. It offers many ways to
handlers. jQuery is handy when it comes to event handling because it's easy to wire event handlers and
process the events. jQuery also allows you to make Ajax calls to ASP.NET web services, web methods,
Windows Communication Foundation (WCF) services, and MVC controller actions.
you may find its syntax a bit odd; but once you get hang of it, you'll probably never look at any other
contains several functions, and you call them individually whenever required. With jQuery, the chain of
operations makes your code compact. jQuery lets you chain methods together so the output from one
method is automatically processed by the next method in the chain. This makes it easier to invoke
multiple methods on the same output.
Downloading and Referring to jQuery
Before you use any of jQuery's features and constructs, you need to refer to it in your Web Forms or MVC
views. You can refer to the jQuery library in two ways:
• Refer to a local copy of the jQuery library.
• Refer to the jQuery library from Microsoft's Ajax Content Delivery Network (CDN).
To refer to a local copy of the jQuery library, you should first download it from jQuery official web site
( http://jquery.com ) to your local machine. If you create a new ASP.NET MVC project, the jQuery library is
automatically placed in the Scripts folder (Figure 2-1). Of course, if you wish to use the latest version of
the jQuery library, you need to download it separately.