VS2008 jQuery Intellisense not working - (jquery-1

2019-07-16 06:28发布

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

3条回答
相关推荐>>
2楼-- · 2019-07-16 06:48

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

查看更多
何必那么认真
3楼-- · 2019-07-16 06:56

@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.

查看更多
甜甜的少女心
4楼-- · 2019-07-16 07:08

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.

查看更多
登录 后发表回答