項目中碰見異常“Uncaught TypeError: $(...).datagrid is not a function”,網上查詢基本上都是jQuery的重復引用,但是找了半天依舊沒找到問題所在,最后發現把“jquery-1.7.1.min.js”文件放到最上面就沒有異常,可以正常使用了。
報異常時引用的文件代碼:
<head> <title>@ViewBag.Title</title> <link href="~/Content/jquery-easyui-1.6.8/themes/icon.css" rel="stylesheet" /> <link href="~/Content/jquery-easyui-1.6.8/themes/default/easyui.css" rel="stylesheet" /> <script src="~/Content/jquery-easyui-1.6.8/jquery.easyui.min.js"></script> <script src="~/Content/jquery-easyui-1.6.8/locale/easyui-lang-zh_CN.js"></script> <script src="~/Scripts/jquery-1.7.1.min.js"></script> <script src="~/Scripts/datapattern.js"></script> <script src="~/Scripts/jquery.validate.min.js"></script> <script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script> </head>
異常:
修改后可用的引用的文件順序(紅框中的jquery文件放到easyui相關js上面就可以了,不明白原因,在此記錄):