在visual studio 2010中使用jquery进行智能感知

时间:2022-11-14 08:11:58

I put those two above. But I get no intellisense with jquery.

我把这两个放在上面。但我没有得到jquery的intellisense。

<script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.js")" type="text/javascript"></script>
<script src="../../Scripts/jquery-1.5.1-vsdoc.js" type="text/javascript"></script>

I also want to achieve intellisense in a javascript file, is it possible?

我也想在javascript文件中实现intellisense,这可能吗?


UPDATE:

更新:

jQuery(function ($) {
    $("").   //no click event handler comes up
});

2 个解决方案

#1


19  

Simple google search came up with this:

简单的谷歌搜索提出了这个:

VS2010 Tips #7: How to make jQuery Intellisense work for external JavaScript file

VS2010技巧#7:如何使jQuery Intellisense适用于外部JavaScript文件

Short answer:

简短回答:

/// <reference path="../../scripts/jquery-1.5.1-vsdoc.js"/>

Note that you can't use the @ sign inside js file like in a Asp.net-MVC View

请注意,您不能像在Asp.net-MVC视图中那样使用@s里面的js文件

Read this to learn how you can overcome this.

阅读本文以了解如何克服这一点。

#2


7  

Right click the project >> Click on 'Add Library Package Reference' >> On the left frame select 'Online' >> On the right most corner frame, enter 'jquery' in the 'Search Online' textbox >> After results come, click and Install the 'jQuery.vsdoc' package.

右键单击项目>>单击“添加库包参考”>>在左侧框架中选择“在线”>>在最右侧的边框上,在“在线搜索”文本框中输入“jquery”>>结果出现后,单击并安装'jQuery.vsdoc'包。

Simple!

简单!

Hope it helped!

希望它有所帮助!

#1


19  

Simple google search came up with this:

简单的谷歌搜索提出了这个:

VS2010 Tips #7: How to make jQuery Intellisense work for external JavaScript file

VS2010技巧#7:如何使jQuery Intellisense适用于外部JavaScript文件

Short answer:

简短回答:

/// <reference path="../../scripts/jquery-1.5.1-vsdoc.js"/>

Note that you can't use the @ sign inside js file like in a Asp.net-MVC View

请注意,您不能像在Asp.net-MVC视图中那样使用@s里面的js文件

Read this to learn how you can overcome this.

阅读本文以了解如何克服这一点。

#2


7  

Right click the project >> Click on 'Add Library Package Reference' >> On the left frame select 'Online' >> On the right most corner frame, enter 'jquery' in the 'Search Online' textbox >> After results come, click and Install the 'jQuery.vsdoc' package.

右键单击项目>>单击“添加库包参考”>>在左侧框架中选择“在线”>>在最右侧的边框上,在“在线搜索”文本框中输入“jquery”>>结果出现后,单击并安装'jQuery.vsdoc'包。

Simple!

简单!

Hope it helped!

希望它有所帮助!