我在 nodejs 项目的 .ejs 文件中包含了 javascript 和 bootstrap。bootstrap css 适用于按钮(例如 btn btn-primary 作品),但下拉菜单不起作用。
//我的index.ejs文件
<!DOCTYPE html>
<html>
<head>
<title>Home automation system</title>
<script src="js/bootstrap.min.js"></script>
<script src="js/myscript.js"></script>
<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/mycss.css">
</head>
<body>
<div class="container">
<div class="test text-center" style="margin-bottom:0">
<h1>Home Automation system</h1>
<p>The first Home Automation system in Bhutan</p>
</div>
<% include partials/navbar.ejs %>
<br><br>
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown button
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a …Run Code Online (Sandbox Code Playgroud)