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?

推荐答案

在外部JavaScript文件的顶部,添加以下内容:

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

确保路径正确(相对于文件在文件夹 struct 中的位置等).

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相关问答推荐

更改后如何使用 jQuery Select CSS 类

jQuery .append() 创建两个元素而不是一个

Ajax 替换而不是追加

提醒未保存的表单更改

模糊事件阻止点击事件工作?

如何在 jQuery Select 器中定义 css :hover 状态?

jQuery切换CSS?

SCRIPT7002:XMLHttpRequest:网络错误 0x2ef3,由于错误 00002ef3 无法完成操作

如何使用jQuery找到元素顶部的垂直距离(以px为单位)

删除所有子元素的 CLASS

jQuery 序列化不注册复选框

将 CSS 应用于 jQuery 对话框按钮

使用 jQuery Select 最后 5 个元素

使用 jquery/ajax 刷新/重新加载 Div 中的内容

jQuery 插件:添加回调功能

JQuery:如果 div 可见

如何使用 jQuery 格式化电话号码

如何将参数传递给 jQuery 中的事件处理程序?

只绑定一次事件

.success() 和 .complete() 之间的区别?