Updated JQuery - get Microsoft JScript runtime error: 'jQuery' is undefined

荒凉一梦 提交于 2020-01-03 17:08:57

问题


All was good until I updated Jquery and now I get get Microsoft JScript runtime error: 'jQuery' is undefined in jquery.validate.min.js- I am at a loss as to what to do.

MVC3 - using Telerik extensions controls - used nuget

_Layout.cshtml (valid paths)

I have tried both script and link tags:

<link href="@Url.Content("~/Scripts/jquery.validate.min.js")" rel="stylesheet" />
<link href="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" rel="stylesheet" />
<link href="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" rel="stylesheet" />

And I tried

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>

Also added to jQuery(false) to scriptregistrar tag

Packages.config

<package id="jQuery" version="1.7.1" />
<package id="jQuery.UI.Combined" version="1.8.17" />
<package id="jQuery.Validation" version="1.9" />

Visual Studio 2010 - running in IE9. Any advice greatly appreciated!


回答1:


Load jquery-1.7.1.min.js before the jquery.validate plugins. And use <script>, not <link>.

<script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobstrusive.min.js")"></script>



来源:https://stackoverflow.com/questions/8981351/updated-jquery-get-microsoft-jscript-runtime-error-jquery-is-undefined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!