When using Bootstrap, I encountered an issue where the submenus are not staying collapsed after expanding a menu and clicking on a submenu. To address this, I modified the code from class="collapse list-unstyled" to class="collapse list-unstyled show". This resolved the issue of menus collapsing but not shrinking when navigating to the next main menu.
<?php include('header.php'); ?>
<div class="wrapper">
<!-- Sidebar -->
<nav id="sidebar">
<ul class="list-unstyled components top_admin">
</ul>
<ul class="list-unstyled components">
<li>
<a href="dashboard.php" data-toggle="collapse" aria-expanded="false" >
<i class="fa fa-tachometer" aria-hidden="true"></i>
<span>DASHBOARD </span>
</a>
</li>
<li>
<a href="#my_note1" data-toggle="collapse" aria-expanded="false" class="dropdown-toggle">
<i class="fa fa-hand-o-up" aria-hidden="false"></i>
<span>My Notes1</span>
</a>
<ul class="collapse list-unstyled " id="my_note1">
<li>
<span class="small_menu"><a href="page1.php">CN</a></span>
<a class="la_cls" href="page1.php">Create Note</a>
</li>
</ul>
</li>
<li>
<a href="#my_note2" data-toggle="collapse" aria-expanded="false" class="dropdown-toggle">
<i class="fa fa-hand-o-up" aria-hidden="false"></i>
<span>My Notes2</span>
</a>
<ul class="collapse list-unstyled " id="my_note2">
<li>
<span class="small_menu"><a href="page1.php">CN</a></span>
<a class="la_cls" href="page1.php">Create Note</a>
</li>
<li>
<span class="small_menu"><a href="#">SN</a></span>
<a class="la_cls" href="#">Search Notes</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
I am seeking assistance in ensuring that after clicking a submenu, it remains collapsed until another main menu is clicked. Any suggestions on how to solve this issue would be greatly appreciated. Thank you in advance.