未捕获的类型错误:无法设置属性“unobtrusive”未定义的
我在 Chrome JScript 调试器中收到此错误。当我将以下脚本切换到 Microsoft CDN 时,就发生了这种情况。
我不知道如何解决这个问题,不再使用 CDN。
jquery.validate.unobtrusive.min.js:5 未捕获的类型错误:无法设置未定义的属性“unobtrusive”
<link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/themes/start/jquery-ui.css" rel='stylesheet' type='text/css'>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.4.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-1.7-development-only.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.11/jquery-ui.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmplPlus.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/mvc/3.0/jquery.validate.unobtrusive.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/mvc/3.0/jquery.unobtrusive-ajax.min.js"></script>
I am getting this error in the Chrome JScript debugger. It happened when I switched to the Microsoft CDNs for the scripts below.
I'm not sure how to work around this save, not using the CDNs anymore.
jquery.validate.unobtrusive.min.js:5
Uncaught TypeError: Cannot set property 'unobtrusive' of undefined
<link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/themes/start/jquery-ui.css" rel='stylesheet' type='text/css'>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.4.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-1.7-development-only.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.11/jquery-ui.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmplPlus.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/mvc/3.0/jquery.validate.unobtrusive.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/mvc/3.0/jquery.unobtrusive-ajax.min.js"></script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
发生此错误的另一个原因是如果您在 jquery.validate 之前加载不引人注目的脚本。
所以,
没问题,但是:
会给出“无法设置未定义的属性‘unobtrusive’”错误。
Another reason this error can occur is if you load the unobtrusive script before jquery.validate.
So,
is OK, but:
will give the "Cannot set property 'unobtrusive' of undefined" error.
找到了。我遗漏了两行:
我是通过阅读此页面了解到这一点的,该页面描述了 jquery.validate 的方式。不引人注目的脚本有效。
Found it. I was missing two lines:
I learned this by reading this page which describes how the jquery.validate.unobtrusive script works.