jquery intellisense vs2010 mvc3

冷暖自知 提交于 2019-12-03 05:27:03
kapsiR

You can also use an if clause like:

 @if (false) { 
    <script src="/Scripts/jquery-1.4.4-vsdoc.js" type="text/javascript"></script>
 }

If u need to add jQuery intellisense to a .js file, add this:

 /// <reference path="../../Scripts/jquery-1.5.1.min.js" />

If u need to add to a .cshtml file, try this:

 @* <reference path="../../Scripts/jquery-1.5.1.min.js" />*@

Visual Studio can read these refs even if they are in comments...which is kinda interesting.

Currenty you need to add a reference to a script in the file that you are editing for JavaScript IntelliSense to work in that fie. This is because layouts in Razor are set imperatively during the page's execution and not declaratively.

Note that you should be able to put HTML comment blocks around your script references so that multiple references to the same script file will be ignored when rendered in the browser.

 @if (false) { 
    <script src="/Scripts/jquery-1.4.4-vsdoc.js" type="text/javascript"></script>
 }

works but i feel its awful. surely there MUST be a Nuget for this!? VS2010 here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!