在寫bootstarp的時候,一直報
Uncaught Error: Bootstrap's JavaScript requires jQuery
查看了自己引入的文件路徑是對的,也可以使用jquery進行操作表單
<script src="node_modules/jquery/dist/cdn/jquery-2.1.1.min.js"> </script> <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css"/> <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
之后導入菜鳥的鏈接
<script src="https://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script> <script src="node_modules/jquery/dist/cdn/jquery-2.1.1.min.js"> </script> <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css"/>
<!--<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
完全可以使用的。boostrap下拉菜單起作用。后來翻看了一下,說:
js文件引入的先后順序,應該先引入jquery的js文件再引入bootstrap的css文件。