问题描述
我在Chrome JScript调试器中遇到此错误.当我切换到下面的脚本的Microsoft CDN时发生了这种情况.
I am getting this error in the Chrome JScript debugger. It happened when I switched to the Microsoft CDNs for the scripts below.
我不确定如何解决此保存问题,不再使用CDN.
I'm not sure how to work around this save, not using the CDNs anymore.
jquery.validate.unobtrusive.min.js:5Uncaught TypeError:无法设置未定义的属性"unobtrusive"
jquery.validate.unobtrusive.min.js:5Uncaught 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>
推荐答案
发生此错误的另一个原因是,如果在jquery.validate之前加载了不引人注目的脚本.
Another reason this error can occur is if you load the unobtrusive script before jquery.validate.
所以
<script src="/scripts/jquery.validate.min.js" type="text/javascript"></script>
<script src="/scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>
可以,但是:
<script src="/scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>
<script src="/scripts/jquery.validate.min.js" type="text/javascript"></script>
将显示无法设置属性'unobtrusive'的未定义"错误.
will give the "Cannot set property 'unobtrusive' of undefined" error.
这篇关于Uncaught TypeError:无法设置未定义的属性"unobtrusive"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!