Scott Hanselman

ASP.NET and jQuery

November 06, 2008 Comment on this post [8] Posted in ASP.NET | ASP.NET Dynamic Data | ASP.NET MVC | Javascript
Sponsored By

image It looks like many of you have already noticed that there's an official Visual Studio autocomplete file for jQuery posted up at the jQuery site. It's significant that it's hosted by the jQuery team in that it's a contribution by the Visual Studio team but it's not up at CodePlex, because it really belongs to jQuery so there's where you'll find it.

This isn't a new jQuery file and nothing's been "forked" so don't freak out. It's just a documentation file, as you can see if you go to the Download jQuery page.

Now, the Visual Studio-specific aspect of this is a temporary thing, as it's planned for Visual Studio to support a more standard syntax at some future date, but until then, there's this file and we'll make sure it's kept updated.

Jeff King has details on how to use this file in your projects. In the VERY near future there will be a hotfix that will cause Visual Studio to look for files that end in "-vsdoc.js" for intellisense which will make including it in your project automatic.

UPDATE: The very near future is NOW. You can now download a small hotfix that causes Visual Studio to automatically look for intellisense files named *-vsdoc.js" next to the runtime file. From Jeff King's blog:

Last week I mentioned we would be releasing a Hotfix to accompany our new jQuery VSDoc file.  This Hotfix is now available at the MSDN Code Gallery.  Here's a direct download link for this small (2MB) patch:

I want to emphasize that this patch is intended for all JavaScript files, not just those related to jQuery.  Generally, we will opportunistically look for documentation files related to the script file.  For example, given "mylibrary.js", we will search in the same directory for:

  • mylibrary-vsdoc.js, then if we don't find it we will search for...
  • mylibrary.debug.js, then if we don't find it we will search for...
  • mylibrary.js

There's a few things that are nice about this jQuery file is that it supports and understands jQuery plug-ins. If you're into jQuery and ASP.NET, go check it out.

Related Links

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
November 06, 2008 11:19
This is awesome! Give it a try people and you'll see the magic. :)
November 06, 2008 12:03
Hello Scott,
I have started using jQuery documentation file in my projects. Its really helpful. I think there should be more things which should be included in VS in future -

1. There should be a folder called "App_Scripts" which will contain scripts file. There should be a switch in Web.Config file, which says whether to "compress" or "minimize" "App_Scripts" folder.
(May be like App_Code folder, you will get automatic intellisense for whatever you have placed in App_Scripts)

2. New templates in VS for creating for jQuery plug-in.

3. Like AJAX Page, there should be jQuery page also ( just give a framework to start) ( I think better to include a whole new group called as jQuery, and in that you have all these file types )

4. You can also provide a URL to look for the documentation and source file. Just press "Update" and get the latest one. (I think jQuery will keep on growing and changing ).

5. And yes people like me, I also dream to "Debug" jQuery, to see how things flow. :)

November 06, 2008 13:40
This is great - it works really well. I find intellisense is so useful not just for quicker typing but also as an on-the-fly learning tool. No matter how many books / tutorials / examples you read there's often something that pops up in an intellisense list that you didn't realise was there :)
November 06, 2008 19:46
First step to owns others IDEs , waiting that vs 2008 or 2010 supports many third jscripts librarys :)
November 06, 2008 20:55
In MVC projects jQuery intellisense doesn't show up if I reference the script files with an absolute root path like "/scripts/jquery-1.2.6-vsdoc.js". However, if I reference it with the tilda relative root it does work "~/scripts/jquery-1.2.6-vsdoc.js"

Who is the best MS contact to report this issue to?
November 06, 2008 22:25

This is great.. I love using jQuery and this makes it just that much eaiser.

November 07, 2008 2:32
Great stuff Scott, I'll add this one to my utility belt!
November 07, 2008 3:40
Excellent stuff! This should really help people get over the barrier to learning jQuery!

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.