I thought jQuery Intellisense was supposed to be improved with SP1. I even downloaded an annotated version of jQuery 1.2.6, but intellisense will not work in a separate jscript file. I have the jQuery library referenced first on my web page in the <head> tag. Am I doing anything wrong?

推荐答案

At the top of your external JavaScript file, add the following:

/// <reference path="jQuery.js"/>

Make sure the path is correct, relative to the file's position in the folder structure, etc.

Also, any references need to be at the top of the file, before any other text, including comments - literally, the very first thing in the file. Hopefully future version of Visual Studio will work regardless of where it is in the file, or maybe they will do something altogether different...

Once you have done that and saved the file, hit Ctrl + Shift + J to force Visual Studio to update Intellisense.

Jquery相关问答推荐

为什么如果使用转换规模,juserui可拖动遏制不起作用

第一次单击后,Ajax addEventListener 停止工作

如何用另一个响应替换窗口的 URL 哈希?

AngularJS 中的 ScrollTo 函数

提交前添加 POST 参数

如何在循环内创建动态变量名称?

如何计算具有相同类的元素数量?

Google Maps API v3 infowindow 关闭事件/回调?

一次替换多个字符串

jquery click 不适用于 ajax 生成的内容

为特定请求禁用 ajaxStart() 和 ajaxStop()

如何知道字体(@font-face)是否已经加载?

聚焦 时防止 iphone 默认键盘

隐藏 div 但保留空白

jQuery 和 jQuery Mobile 的区别?

如何使用 javascript (jquery) 将整数值添加到返回字符串的值中?

滚动 DIV 元素时如何防止页面滚动?

什么时候应该使用 jQuery deferred 的then方法,什么时候应该使用pipe方法?

jQuery .hasClass() 与 .is()

PHPStorm IDE 中低效的 jQuery 使用警告