VS2010 Tips #7: How to make jQuery Intellisense work for external JavaScript file

Simply drag-n-drop the jQuery library from Solution Explorer to the opened external JavaScript file.

image

The Intellisense should work now.

image

Make donation to this article:


Posted

in

by

Comments

28 responses to “VS2010 Tips #7: How to make jQuery Intellisense work for external JavaScript file”

  1. […] This post was mentioned on Twitter by Ferry Meidianto. Ferry Meidianto said: VS2010 Tips#7: How to make jQuery Intellisense work for external JavaScript file http://bit.ly/9RkQjm […]

  2. BlueRaja Avatar

    HOLY CRAP SO SEXY

    I can’t get over how easy this was. Thanks man!

  3. Stuart Avatar
    Stuart

    My life just got a whole lot easier. Thanks!

  4. Yogi Legnon Avatar

    Thanks a ton! I was really getting aggravated wihout my intellisense. It has really spoiled me.

  5. Ilija Injac Avatar

    Ferry – you saved my day! Thank you so much, man!

  6. eggpoker Avatar
    eggpoker

    not working on my pc.
    would you pls help?
    is there any patch that must be installed on vs2010?

  7. Ferry Meidianto Avatar

    No need to install a patch for VS2010 I believe. It was for VS2008.
    Make sure that the JS is in your Project and drag it to the editor.

  8. Frithjfo Avatar
    Frithjfo

    Nice one 😀

    If someone has the same problem:

    The line generated by the “magic drag drop”
    /// reference path=../pathtofile.js

    must be the first line of the js file, where you want to use intellinsense…

  9. Greg K Avatar
    Greg K

    What about:
    (function ($) {
    test = function () {

    };
    })(jQuery);

    is it working inside test function?

  10. João Batista Avatar
    João Batista

    Thanks for the quick (but really useful) help!

  11. […] jQuery 1.4.1 Intellisense with Visual Studio VS2010 Tips #7: How to make jQuery Intellisense work for external JavaScript file Blog this! Bookmark on Delicious Digg this post Share on dzone Recommend on Facebook Share on […]

  12. vinny Avatar
    vinny

    This doesn’t work for my 🙁 I was really hoping to get some jquery intellisense because we’re using this more and more.

    Any ideas of what could be wrong in vs2010 professional sp1 ?

  13. Ferry Meidianto Avatar

    Try resetting your environment settings.
    Tools -> Import and Export settings -> Reset all settings

  14. Lukas Avatar
    Lukas

    @Frithjfo: Thank you!
    The references must indeed be the very first lines of the document.

  15. Thomas K. Nielsen Avatar
    Thomas K. Nielsen

    Perfect thanks. Just what I needed.

    I had some problems dragging and dropping in the ide if anybody else have that problem you need to remember to “check” the option

    tools > options > Text editor > general > Drag and drop editing

    I think it’s “checked” by default, but I might have turned it off and then you cannot drag and drop like that.

  16. Caleb Leak Avatar
    Caleb Leak

    Thanks Ferry and also Frithjfo! I also was unable to get this work until I stuck the /// at the top of my file, even before other comments. Works great now.

  17. PilotBob Avatar

    So, how do you keep these up to date as you upgrade your jQuery scripts to newer versions?

    My thought is to modify the file names in my scripts folder to a “non versioned” number and make sure to update those files as I change my script references to new versions.

    BOb

  18. Panoone Avatar
    Panoone

    Genius, PilotBob. That’s just what I did. 🙂

    For others who are having difficulty (like I was), as the FIRST line in your custom js file, add the following project RELATIVE reference link to your jQuery file.

    ///

    As PilotBob mentioned, usinga generic name means not having to worry about update issues.

    Just be sure to keep the version number intact in the jQuery file itself for eases of identification.

    /*! jQuery v1.x.x http://jquery.com/ | http://jquery.org/license */

  19. […] VS2010 Tips #7: How to make jQuery Intellisense work for external JavaScript file […]

  20. […] VS2010 Tips #7 Share this:Like this:LikeBe the first to like this. Categories: Jquery Tags: enable jquery […]

  21. Lino Silva Avatar

    This is amazing. Thanks for the tip!

  22. mayur Avatar
    mayur

    Much needed tip for jquery..thanks a lot!!

  23. Madhubm Avatar
    Madhubm

    This was amazingly simple. Thanks a ton!

  24. […] VS2010 Tips #7: How to make jQuery Intellisense work for outmost JavaScript file […]

  25. Sam Avatar
    Sam

    Beautiful. Simple and elegant. Please put on up for VS 2015 as well..

Leave a Reply

Your email address will not be published. Required fields are marked *