Errors using Microsoft jQuery vsdoc 1.7.1 CDN with Visual Studio 2010

I get the following JavaScript errors when using jQuery vsdoc with VS 2010. Errors disappear if I delete the vsdoc.js line. I tried adding var rootjQuery = jQuery(document); but new errors appear. I do not want this to be fixed.

 Line: 68 Error: 'rootjQuery' is undefined Line: 8 Error: Object doesn't support this property or method <head> <title>Index</title> <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.js"></script> <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1-vsdoc.js"></script> <script type="text/javascript"> $(document).ready(function () { }); </script> </head> 

solvable

I have found the answer. Just reverse the order of the jQuery and vsdoc script shortcuts.

 <head> <title>Index</title> <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1-vsdoc.js"></script> <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.js"></script> <script type="text/javascript"> $(document).ready(function () { }); </script> </head> 
+6
source share
1 answer

reordering stopped javascript errors

and it did not work with any part of T4MVC

so i did it

  @if (System.Diagnostics.Debugger.IsAttached) { <script src="../../Scripts/Mvc3/jquery-1.7-vsdoc.js" type="text/javascript"></script> @* intellisense! *@ @Html.RelativeJavascript(Links.Scripts.Mvc3.jquery_1_7_js) @Html.RelativeJavascript(Links.Scripts.Mvc3.jquery_unobtrusive_ajax_js) } else { @Html.RelativeJavascript(Links.Scripts.Mvc3.jquery_1_7_min_js) @Html.RelativeJavascript(Links.Scripts.Mvc3.jquery_unobtrusive_ajax_min_js) } 

but I only seem to get Intellisense for javascript written on the page (not in my src= files)

EDIT: MSDN-based learned how to get intelli-sense in offline files

 /// <reference path="../Mvc3/jquery-1.7-vsdoc.js" /> 

Also dragging and dropping solutions from the browser into the .js file worked!

0
source

Source: https://habr.com/ru/post/902955/


All Articles