Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting intellisense to work for JQuery and javascript in .js files using Visual Studio 2008

I followed ScottGu's advice on enabling javascript intellisense using a -vsdoc.js file.

http://weblogs.asp.net/scottgu/archive/2008/11/21/jquery-intellisense-in-vs-2008.aspx

I now get intellisense when I write javascript inside my HTML/ASPX files. I write most of my javascript in separate javascript files that I attach to my code with script tags like this:

<script type="text/javascript" src="./js/myhappyjavascript.js"></script>

In files like this I don't get the intellisense and this is where I need it most. Does anyone know how I can get intellisense on jquery to work there too?

like image 582
minty Avatar asked Feb 12 '09 17:02

minty


2 Answers

Sure, add

/// <reference path="path-to-jquery" />

at the very beginning of your js file.

like image 165
Andrey Shchekin Avatar answered Nov 15 '22 05:11

Andrey Shchekin


You can also include a reference to your aspx page at the beginning of your js file and intellisense will behave like you are on the page.

/// <reference path="mypage.aspx" />

You might want to take a look at the reference for the reference tag.

http://blogs.msdn.com/webdevtools/archive/2007/11/06/jscript-intellisense-a-reference-for-the-reference-tag.aspx

like image 34
Glenn Lang Avatar answered Nov 15 '22 07:11

Glenn Lang