Uncaught TypeError: $(...).datagrid is not a function
项目中碰见异常“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上面就可以了,不明白原因,在此记录):