JQuery and SharePoint 2007

What is jQuery?

jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development (wikipedia article). It was created by John Resig and dual licensed under the MIT License and the GNU General Public License, jQuery is free and open source software. It has an impressive (really impressive) user list - Sites Using jQuery. Even the newly redesigned and ASP.NET powered White House website uses jQuery heavily.

Why jQuery?

jQuery, though widely popular now, is not the only JavaScript library/farmework around. Prototype, script.aculo.us, and Dojo Toolkit are some other popular libraries. I would recommend reading Wikipedia article - Comparison of JavaScript frameworks for framework comparison and viewing John Resig's presentation - JavaScript Library Overview for library concepts and features.

Refer to Why jQuery’s Philosophy is Better and Why does everyone like jQuery more than prototype/script.aclo.us or mootools or whatever?

For an alternate view, read the Why I still prefer Prototype to jQuery post by Glenn Vanderburg - " ... And here’s the capsule summary: jQuery is a very nice piece of work, and makes some common tasks easier than their Prototype equivalents. Where it’s good, it’s very good indeed. But its design is uneven, and its scope is limited. For me, at least, Prototype is still the tool of choice. I think it’s a richer, more thorough, and overall better designed library...."

Some Performance Statistics

The MooTools vs JQuery vs Prototype vs YUI vs Dojo Comparison Revised post on Peter Velichkov's Blog gives the performance test results in detail. In this the jQuery version 1.2.6 was tested. The updated version - Release jQuery 1.3 is 49% faster than previous version. Check the stats here.

Microsoft Support

In Sep 2008, Microsoft announced that jQuery will become part of the official development platform. Going forward no more comparisons between different frameworks, I can now concentrate on leveraging jQuery in SharePoint. JQuery will come with Visual Studio in the long term, and in the short term it'll ship with ASP.NET MVC. For more details, read:

In Nov 2008, the jQuery intellisense annotation support was released as a free download - VS2008 SP1 Hotfix to Support "-vsdoc.js" IntelliSense Doc Files.

Where to download?

jQuery code is available in two formats:

  • Compressed  - has a significantly smaller file size - for production environment
  • Uncompressed - good for debugging - for development environment

Download URL: Current Release

Where to learn?  

Start with John Resig's article - How jQuery Works. This gives a basic introduction to jQuery and the concepts that you need to know to use it. Tutorials in mutplie languages are available in the Tutorials - jQuery JavaScript Library website.

jQuery Cheatsheet is a must have for new developers. For tips and sample code refer to following links:

jQuery in SharePoint 2007

Lot of information is currently available on using jQuery in SharePoint 2007. I would recommend that start by reading "Integrating SharePoint 2007 and jQuery" - Part One and Part Two posts on Jan Tielens' blog. Jan has also created a jQuery powered DockNavigation component and TableRow Highlight available as part of the SmartTools for SharePoint CodePlex project. Do not miss them, download today and use them.

End User SharePoint is "the" website for learning to apply jQuery magic on SharePoint. Some articles I like are:

I would advise that subscribe their RSS feed as great articles get published there and literally everyday! Great work by Paul GrenierWaldek Mastykarz and team.

Besides this, there are lot of CodePlex projects using jQuery and articles like Paging large content in SharePoint using jQuery.