03.11.2016 Views

Beginning ASP.NET 4.5 in CSharp and VB Opsylum

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

386 x CHAPTER 11 JQUERY<br />

Fortunately, the Internet developer community has been very active develop<strong>in</strong>g frameworks that use<br />

JavaScript under the hood <strong>and</strong> that extend its power, while offer<strong>in</strong>g a very rich feature set that helps<br />

you create <strong>in</strong>teractive client-side web pages. Over the years, many JavaScript libraries have been<br />

developed—most of which are free—<strong>in</strong>clud<strong>in</strong>g:<br />

‰ Prototype (http://prototypejs.org)<br />

‰ Scriptaculous, an add-on to Prototype (http://script.aculo.us)<br />

‰ Ext JS (http://extjs.com)<br />

‰ Dojo (http://dojotoolkit.org)<br />

One framework that has received a lot of attention is jQuery. Initially developed <strong>and</strong> released by<br />

John Resig <strong>in</strong> January 2006, jQuery has grown to be a very popular client-side framework. It also<br />

caught the attention of Microsoft, which decided to start shipp<strong>in</strong>g jQuery with Microsoft products.<br />

Initially, jQuery shipped with the Microsoft <strong>ASP</strong>.<strong>NET</strong> MVC Framework, but it’s now also <strong>in</strong>cluded<br />

<strong>in</strong> Visual Studio 2012.<br />

AN INTRODUCTION TO JQUERY<br />

The ma<strong>in</strong> focus of the jQuery library has always been to simplify the way you access the elements <strong>in</strong><br />

your web pages, provide help <strong>in</strong> work<strong>in</strong>g with client-side events, enable visual effects like animations,<br />

<strong>and</strong> make it easier to use Ajax <strong>in</strong> your applications. In January 2006, John Resig announced the first<br />

version of jQuery, which was followed by an official release of jQuery 1.0 <strong>in</strong> August 2006. Many<br />

more versions would follow, with version 1.7.2 as the latest, stable release at the time of writ<strong>in</strong>g.<br />

NOTE jQuery is under active development, <strong>and</strong>, as such, there’s a fair chance<br />

that by the time you read this book, a new version of jQuery will have been<br />

released. Although the code presented <strong>in</strong> this chapter is expected to be compatible<br />

with future versions, backward-compatibility issues may arise with later<br />

versions. If you fi nd that some of your code doesn’t work with the jQuery version<br />

you are us<strong>in</strong>g, consider us<strong>in</strong>g the fi les that come with this chapter’s download to<br />

rule out any problems with the new version.<br />

You have a few ways to acquire the jQuery library <strong>and</strong> add it to your website. First of all, you can<br />

download the latest version of jQuery from the official website at http://jquery.com. Not only<br />

will you f<strong>in</strong>d the downloadable files there, but you’ll also f<strong>in</strong>d the documentation, FAQs, tutorials,<br />

<strong>and</strong> much more <strong>in</strong>formation you can use to make the most out of jQuery.<br />

The second way is to use the <strong>ASP</strong>.<strong>NET</strong> Web Forms Site template to create a new site, because it<br />

already conta<strong>in</strong>s a Scripts folder with the necessary jQuery files. However, back <strong>in</strong> Chapter 2 you<br />

based the Planet Wrox website on the <strong>ASP</strong>.<strong>NET</strong> Empty Web Site template, which doesn’t <strong>in</strong>clude<br />

these files.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!