I am currently working on a website project using Bootstrap 5. In the navigation bar of my site, I have implemented a dropdown menu with multiple submenus that dropend.
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="07656868737473756677473229372935">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="92f0fdfde6e1e6e0f3e2d2a7bca2bca0">[email protected]</a>/dist/js/bootstrap.bundle.min.js"></script>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item dropdown" data-bs-toggle="dropdown" id="route-4" aria-haspopup="true" aria-expanded="false">
<a class="nav-link dropdown-toggle" href="#">Categories</a>
<ul class="dropdown-menu" aria-labelledby="route-4">
<li class="nav-item dropdown-item dropdown dropend" data-bs-toggle="dropdown" id="route-5" aria-haspopup="true" aria-expanded="false">
<a class="nav-link py-0" href="#">Category 1</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="route-5">
<li class="nav-item dropdown-item"><a class="nav-link py-0" href="#">Subcategory 1</a></li>
<li class="nav-item dropdown-item"><a class="nav-link py-0" href="#">Subcategory 2</a></li>
</ul>
</li>
<li class="nav-item dropdown-item dropdown dropend" data-bs-toggle="dropdown" id="route-9" aria-haspopup="true" aria-expanded="false">
<a class="nav-link py-0" href="#">Category 2</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="route-9">
<li class="nav-item dropdown-item"><a class="nav-link py-0" href="#">Subcategory 1</a></li>
<li class="nav-item dropdown-item"><a class="nav-link py-0" href="#">Subcategory 2</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
The issue I am facing is that when I toggle any category, only the first subcategory menu toggles.
I have attempted to use data-bs-target
but it did not resolve the problem.
Just to provide some context, I used npm to install Bootstrap for this project.
Is there anyone who can assist me with this?