Search This Blog

Monday, February 15, 2010

Getting JQuery Intellisense working in Visual Studio 2008

People have been using JQuery in Visual Studio successfully for over a year and there are a lot of links on how to set it up, but I thought I'd write myself a few notes on how to do it since I'm finding myself doing it on various machines (work desktop, home desktop, netbook, etc.) over time and need a quick cheat sheet.

1) Get the latest version of jquery from JQuery at http://docs.jquery.com/Downloading_jQuery. As of this writing it's version 1.4.1. Download the "jquery-1.4.1.js" file (the uncompressed version) and the related Visual Studio documentation file, "jquery-1.4.1-vsdoc.js."

2) Make sure you've got SP1 installed on Visual Studio 2008. You can check to see if it's installed by going to the "Help" tab and then the properties menu to check if the service pack has been installed:



















If it isn't installed, you can get it here: http://www.microsoft.com/downloads/details.aspx?FamilyID=27673c47-b3b5-4c67-bd99-84e525b5ce61&displaylang=en

Note on installing the service pack: Be prepared to give it like 40+ minutes to run, plus have your Visual Studio 2008 release DVD around (or have the install files available somewhere on the hard disk) since it'll be asking for it during the upgrade.

3) Download the hotfix from Microsoft to support Jquery Intellisense:
http://code.msdn.microsoft.com/KB958502/Release/ProjectReleases.aspx?ReleaseId=1736

4) Test it out with a small JQuery project. Create an ASP.NET web project, then add a "scripts" folder to the project and copy both the JQuery files downloaded earlier ("jquery-1.4.1.js" and "jquery-1.4.1-vsdoc.js") into it; add a "script" section to the ASP.NET markup of the page and add a reference to the JQuery file (see illustration) and type "$" to see if Intellisense is up and working -- :
















5) Typing a period after the dollar sign ("$.") should produce more JQuery Intellisense documentation and indicates that Intellisense and JQuery are now working together fine:


No comments: