seajs加載jquery時提示$ is not a function該怎么解決
更新時間:2015年10月23日 09:46:25 投稿:mrr
這篇文章主要介紹了seajs加載jquery時提示$ is not a function該怎么解決的相關資料,需要的朋友可以參考下
jquery1.7以上的都支持模塊化加載,只是jquery默認的是支持amd,不支持cmd。所以要用seajs加載jquery時,我們需要稍微做下改動,需要把以下內容做下修改,具體修改方式如下:
把
if (typeof define === "function" && (define.amd)) {
define( "jquery", [], function() {
return jQuery;
});
}
改成
if (typeof define === "function" && (define.amd || define.cmd)) {
define( "jquery", [], function() {
return jQuery;
});
}
或
if (typeof define === "function") {
define( "jquery", [], function() {
return jQuery;
});
}
通過以上代碼的修改就可以成功解決seajs加載jquery時提示$ is not a function問題,希望對大家有所幫助。
相關文章
BootStrap table表格插件自適應固定表頭(超好用)
這篇文章主要介紹了BootStrap table表格插件自適應固定表頭(超好用)的相關資料,非常不錯,具有參考借鑒價值,需要的朋友可以參考下2016-08-08

