jQuery with ASP.NET

Building rich UI with jQuery and ASP.NET

How To Enable IntelliSense For jQuery in Visual Studio 2010

without comments

By default IntelliSense in Visual Studio doesn’t know anything about jQuery. So for instance if you try get some help as soon as you type ‘$’ IntelliSense won’t suggest you anything useful.

Enabling support for jQuery is very simple. , but first let’s make sure that we are in the same starting point.

Get jQuery and jQuery documentation for IntelliSense

This is the goal:

jQuery files

How to achieve that?

There are 2 options:

  1. Create new project in VS 2010 using optionĀ ’ASP.NET Web Application’. In Scripts folder you should have jQuery and jQuery IntelliSense documentation already included. (however in version 1.4.2)
    New Project in VS 2010 - ASP.NET Web Application
  2. Download manually, the latest files for version jQuery 1.7.2:
    1. jquery-1.7.2.js – development file, uncompressed file
    2. jquery-1.7.2.min.js – production file, minified and gzipped
    3. jquery-1.7.2-vsdoc.js – documentation file which is required to enable IntelliSense for jQuery in VS 2010

How to enable IntelliSense for jQuery

  1. Create new JScript file, for exampleDefault.js
  2. Drag & drop jquery-1.4.1-vsdoc.jsĀ file into the Default.js file.

    IntelliSense drag-and-drop

    when this is done your JS file should loke like this:

    /// <reference path="jquery-1.4.1-vsdoc.js" />
  3. Now you can start using IntelliSense, here are a few examples:

    jQuery IntelliSense
    jQuery IntelliSense 2

    jQuery IntelliSense 3

  4. Enjoy! :)

VN:F [1.9.20_1166]
Rating: 10.0/10 (5 votes cast)
How To Enable IntelliSense For jQuery in Visual Studio 2010, 10.0 out of 10 based on 5 ratings

Written by admin

August 4th, 2010 at 4:54 pm

Posted in Basic Level,Tips

Tagged with

Leave a Reply