Gary Davis' Blog

DotNET/PayPal Development and other Techie Stuff
posts - 47, comments - 170, trackbacks - 0

How to Enable jQuery Intellisense in Your MVC 3 Razor Code

You probably include your <script> to pull in the jQuery JavaScript in your layout.cshtml (master page in Razor), perhaps something like this:

<script src="" type="text/javascript"></script>

But your code pages that use jQuery do not show Intellisense. To enable Intellisense, add this to the top of the pages so Visual Studio has a reference to the vsdoc which is hosted by the Microsoft CDN:

@if (false) {<script src="" type="text/javascript" />}

The if statement will prevent the script tag from being emitted to the browser since it is only needed for Visual Studio development.jquery

It is not necessary to specify the path to the vsdoc file since Visual Studio knows to look for the vsdoc in the same location and use it if it finds it.

The Intellisense is shown based on deleting then typing the open paren at the point indicated.

BTW, the $(function() at the top of the example is a common shorthand for $(document).ready(function().

The CDN used is the Microsoft Ajax Content Delivery Network and they changed the domain from to to improve performance and prevent cookie transmission.

The CDN also has the files for the jQueryUI .js and .css for the themes.

<link type="text/css" rel="Stylesheet" 
    href="" />
<script type="text/javascript" 

Note that the current versions of these files at this time is 1.6.2 for jQuery and 1.8.14 for jQueryUI.

Print | posted on Monday, May 30, 2011 12:00 AM | Filed Under [ Programming ]



# re: How to Enable jQuery Intellisense in Your MVC 3 Razor Code

Thank you so much. I needed this bad. Great contribution.
12/7/2012 7:43 PM | James Bailey

Post Comment

Please add 5 and 4 and type the answer here:

Powered by:
Powered By Subtext Powered By ASP.NET