Wednesday, June 3, 2009

Jquery 1.3.2 & Intellisense in Visual Studio 2008

After following the directions to get intellisense working with the latest version of jquery, I ran into some issues.

First I would get this error:



Error updating JScript IntelliSense: D:\Source\...\JS\jquery\jquery-1.3.2.js: Object doesn't support this property or method @ 18:9345


The first problem is that the file which has the enhanced comments for intellisense is named jquery-1.3.2-vsdoc2.js. Visual Studio is looking for a *vsdoc.js. Make sure you rename the file to jquery-1.3.2-vsdoc.js.

After renaming the file I was greated with this lovely error:


Error updating JScript IntelliSense: D:\Source\...\JS\jquery\jquery-1.3.2-vsdoc.js: 'div.childNodes' is null or not an object @ 1487:1


My understanding is that the code inside the methods doesn't really matter (Assuming it's not changing the object definitions of course). Since this code will never be ran, I simply removed line 1488 which looks like:


elem = jQuery.makeArray(div.childNodes);



And now we have intellisense working with jquery 1.3.2




Edit


I've noticed a lot of traffic recently on this post, if this post has helped resolve your issue (or not helped) leave a comment let others know.

Thank you and good luck

-jb

12 comments:

Anonymous said...

This resolved my issue - thank you!

Josh Berke said...

Awsome thanks for letting me know!

Mike said...

The filename issue resolved my problem, after restarting VS.

Thanks!

Josh Berke said...

@Mike,

Interesting, I'm preety sure I tried restarting VS but can't remember now. I was very apprehensive about removing stuff from the js file.

Gordon Moore said...

nt. I'd seen a lot of posts but this one worked perfectly for me on Visual Web Developer 2008 sp1

Cheers

Russ C. said...

Thanks, this helped me out a lot!

Anonymous said...

Also be aware that you should add the main javascript file to your page to get intellisence. Adding ".min" or ".pack" versions of jQuery causes the same problem too!

Anonymous said...

I got intellisense on my aspx page but how do I get it in my .js page?

Anonymous said...

Josh, thanks very much for this solution. Removing the "2" from the -vsdoc name fixed my problem.

Previous Poster, to get the intellisense working in your .js files, you will need to add a reference tag such as '/// <reference path="../../js/jquery-1.3.2.min.js" />' (without the single quotes). You can simply drag the file from the Solution Explorer in to the code in your .js file and it Visual Studio will automatically create the tag for you.

Unknown said...

Sweet...Thanks!

Unknown said...

Thanks man this really helped me, you are a really smart guy. I just would have never thought of it.

Ramone Hamilton said...

This most definitely worked for me. Great Article.