Visual Studio Intellisense for jQuery

Intellisense for javascript was one of the best new features to come with Visual Studio 2008, and now intellisense has come to jQuery. Whether you are just learning jQuery or just want a convenient reference, Intellisence support for jQuery will save you major amounts of time when working with jQuery.

Step 1. Download jQuery in whatever package you prefer (Minified, Gzipped, Uncompressed), the format of the library doesn’t matter as all documentation is contained in the –vsdoc.js file. Both jQuery and the Intellisence documentation can be found here

Step2. Add both files to Visual Studio. Not really brain surgery, but kinda necessary.


Step3. Add references to the .js files in your solution. Note, since the –vsdoc.js file is only useful to Visual Studio, we don’t want to needlessly add script references that slow down the overall load times of your site, so we wrap the –vsdoc.js reference in the if statement you see below. This way the file will be available to Visual Studio at design time, but not included in the page at run time.


Additionally if you are building a .js file that relies on jQuery you can enable Intellisence within the .js file by adding the following reference


Finally if you are building a User Control that relies on jQuery Visual Studio may not be able to pick up your script references. In this case you can include the –vsdoc.js script reference again in the markup of your User Control without any worries since wrapping it in the ‘if’ statement means it does absolutely nothing to the site at run time.