seajs加载jquery提示$ is not a function

jquery1.7以上的都支持模块化加载,只是jquery默认的是支持amd,不支持cmd。因此要用seajs加载jquery,须要稍微改下jqueryjquery

 

模块化

1 if (typeof define === "function" && (define.amd)) {
2     define( "jquery", [], function() {
3         return jQuery;
4     });
5 }

改为spa

1 if (typeof define === "function" && (define.amd || define.cmd)) {
2     define( "jquery", [], function() {
3         return jQuery;
4     });
5 }

code

1 if (typeof define === "function") {
2     define( "jquery", [], function() {
3         return jQuery;
4     });
5 }

就能够了blog

相关文章
相关标签/搜索