After following through various step-by-step instructions on getting the JQuery intellisense to work with Visual Studio 2008 SP1, I was still having issues getting it to work correctly. The first and slightly more obvious reason for the intellisense to not work was down to using absolute paths for the script file.
<script type=”text/javascript” src=”/Scripts/jquery-1.3.2.min.js”></script>
This should be
<script type=”text/javascript” src=”~/Scripts/jquery-1.3.2.min.js”></script>
The second and far more idiosyncratic problem was occurring when I had also referenced other script files. So, I would have something like the following.
<script type=”text/javascript” src=”~/Scripts/jquery-1.3.2.min.js”></script>
<script type=”text/javascript” src=”~/Scripts/another-script.js”></script>
Strangely enough every time I referenced an additional script to the jquery core in my Site.Master the intellisense would suddenly stop working. It turns out that there is a dependency on an associated file named with a -vsdoc suffix to the script filename.
For the above example you would need an “another-script-vsdoc.js” file located in the same folder as the actual script file. It doesn’t matter whether this contains any comments to support Visual Studio intellisense, it merely needs to exist.
An additional note to point out is that the intellisense will not work if you are using any kind of server side scripting in the path, which is also pretty obvious if you think about it.
<script type=”text/javascript” src=”<%=ResolveUrl(“~/Scripts/jquery-1.3.2.min.js”)%>“></script>