13

I put those two above. But I get no intellisense with jquery.

<script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.js")" type="text/javascript"></script>
<script src="../../Scripts/jquery-1.5.1-vsdoc.js" type="text/javascript"></script>

I also want to achieve intellisense in a javascript file, is it possible?


UPDATE:

jQuery(function ($) {
    $("").   //no click event handler comes up
});
gdoron
  • 147,333
  • 58
  • 291
  • 367
BlackFire27
  • 1,470
  • 5
  • 21
  • 32

2 Answers2

19

Simple google search came up with this:

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

Short answer:

/// <reference path="../../scripts/jquery-1.5.1-vsdoc.js"/>

Note that you can't use the @ sign inside js file like in a Asp.net-MVC View

Read this to learn how you can overcome this.

Community
  • 1
  • 1
gdoron
  • 147,333
  • 58
  • 291
  • 367
7

Right click the project >> Click on 'Add Library Package Reference' >> On the left frame select 'Online' >> On the right most corner frame, enter 'jquery' in the 'Search Online' textbox >> After results come, click and Install the 'jQuery.vsdoc' package.

Simple!

halfer
  • 19,824
  • 17
  • 99
  • 186
Deepak Pathak
  • 626
  • 1
  • 9
  • 19
  • Hmmm, didn't even find the first option ("Add Library"). Are you sure this is for VS2010 (like the OP) or that there aren't any other requirements? – Charles Roberto Canato Jun 14 '14 at 12:41
  • @CharlesRobertoCanato - Looks like you don't have Nuget installed on your VS2010 installation. please install it from below link and then try. Good Luck! http://visualstudiogallery.msdn.microsoft.com/27077b70-9dad-4c64-adcf-c7cf6bc9970c – Deepak Pathak Jun 17 '14 at 07:22
  • in fact I do, but the string is different than yours. Anyway I replied too early, didn't even notice you were talking about adding a package. Anyway I already tried that (manually, because I use an earlier version), still not working. Will investigate more in another time, thanks. – Charles Roberto Canato Jun 24 '14 at 12:57