引入bootstrap CDN后,报错 Uncaught ReferenceError: $ is not defined
来源:3-5 webpack对脚本和样式的处理
我的天去
2018-08-20
Uncaught ReferenceError: $ is not defined
at Object.<anonymous> (index.js:64)
at __webpack_require__ (index.js:20)
at Object.<anonymous> (index.js:47)
at __webpack_require__ (index.js:20)
at index.js:40
at index.js:43
(anonymous) @ index.js:64
__webpack_require__ @ index.js:20
(anonymous) @ index.js:47
__webpack_require__ @ index.js:20
(anonymous) @ index.js:40
(anonymous) @ index.js:43
写回答
2回答
-
jerrychane
2019-06-14
jquery文件必须等body加载之后,才会生效,需要放在<body>之后都可以;
另外注意index.js的顺序,需放在jquery之后;
我的解决方案如下:
<body> <script type="text/javascript" src="https://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script> <script type="text/javascript" src="../../dist/js/index.js"></script> </body>
00 -
Rosen
2018-08-26
没有引入 jquery,代码打包发来看看吧
00
相似问题