VS2008 jQuery Intellisense not working - (jquery-1.4.1.js)

本秂侑毒 提交于 2019-12-24 02:22:12

问题


I have searched on google, followed scottguthrie's article & also here on SO for a solution but to no avail. My environment consists of VS2008 SP1, including hotfix for JQuery intellisense.

I have downloaded 'jquery-1.4.1.js' & also 'jquery-1.4.1-vsdoc.js' from the jquery website. Referenced it in an 'HTM' file like this:

<script src="Js/jquery-1.4.1.js" type="text/javascript"></script>

and when i write code like below, there is no intellisense.

<script type="text/javascript">     
  $
</script>

Any ideas? TIA


回答1:


while in your script tag, press CTRL-SHIFT-J. Watch the status bar for messages e.g. 'updateing js intellisense'

Then look at your Errors List and make sure there were no errors.

VS actually parses all the referenced javascript, effectively compiling it, to generate intellisense.

If there are errors in the JS, intellisense is broken. That is just the way it is. It encourages clean code with tough love.

jQuery is a notorious source of intellisense breakage. Get a baseline by closing all documents, create a new html, reference jquery, ensure the vsdoc file has the same name + -vsdoc and that it is in the same directory. Press CTRL-SHIFT-J and ensure no errors have borked intellisense.

Then start adding your scripts.

Good luck.




回答2:


Works! It turns out to be an issue with VS2008 SP1, i have no idea why but after re-installing it, intellisense works.




回答3:


@BhejaFry Did you reinstall only the SP1 or entire Visual Studio?

I have the exact same problem - intellisense works in .js files but it doesn't work for .aspx or .ascx. I use the hack:

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

But also in files that I use the script normally I don't get intellisense. Of course I have the htofix and -vsdoc. Id doesn't seem to help.



来源:https://stackoverflow.com/questions/2307555/vs2008-jquery-intellisense-not-working-jquery-1-4-1-js

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