本文介绍了为什么我得到Uncaught TypeError:无法读取未定义的属性'unobtrusive'(重复2次)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的网页添加的参考的屏幕截图。我使用的是MVC 4 Razor。

Here is the screenshot of references my page is adding. I am using MVC 4 Razor.

编辑:

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.20/jquery-ui.min.js"></script>
<link href="/MaxVSM/css/jquery-ui.min.css" rel="stylesheet" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>


<script type="text/javascript">
    var ApplicationRoot = '/MaxVSM';
    if (!window.jQuery) {
        document.write('<script type="text/javascript" src="/MaxVSM/Scripts/jquery-1.7.1.js"><\/script>');
        document.write('<script type="text/javascript" src="/MaxVSM/Scripts/jquery-ui-1.8.20.min.js"><\/script>')
    } else {
        if (!window.jQuery.ui)
            document.write('<script type="text/javascript" src="/MaxVSM/Scripts/jquery-ui-1.8.20.min.js"><\/script>')
    }
</script>

<link href="/MaxVSM/css/normalize.css" rel="stylesheet"/>
<link href="/MaxVSM/css/foundation.css" rel="stylesheet"/>
<link href="/MaxVSM/css/Common.css" rel="stylesheet"/>

<script src="/MaxVSM/Scripts/jquery.unobtrusive-ajax.js"></script>
<script src="/MaxVSM/Scripts/jquery.validate.js"></script>
<script src="/MaxVSM/Scripts/jquery.validate.unobtrusive.js"></script>
<script src="/MaxVSM/Scripts/modernizr-2.5.3.js"></script>
<script src="/MaxVSM/Scripts/knockout-2.1.0.debug.js"></script>

<script src="/MaxVSM/Scripts/json2.js"></script>
<script src="/MaxVSM/Scripts/jquery.qtip-1.0.0-rc3.js"></script>
<script src="/MaxVSM/Js/Common.js"></script>
<script src="/MaxVSM/Js/CustomDateControl.js"></script>

if(!window.jQuery)
其实我通过Google API提供了jQuery的参考。如果在页面上找不到它,它将引用jQuery的本地路径。

if (!window.jQuery):Actually I am giving the reference of jQuery through Google APIs. If it is not found on the page it will refer to local path for jQuery.

推荐答案

编辑,之前添加:

<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/additional-methods.min.js"></script>

这篇关于为什么我得到Uncaught TypeError:无法读取未定义的属性'unobtrusive'(重复2次)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 04:13