After clicking the button, the entire sidebar toggles, but I only want the side menus to toggle. Here is the relevant HTML code:
<nav id="sidebar">
<div class="sidebar-header">
<img src="/fintantra/images/logo.jpg" style="margin-left:4px;">
<div class="btn-group">
.....
......
<ul class="list-unstyled components" id="demo">
<li>
<a href="#adminSubmenu" data-toggle="collapse" aria-expanded="false" class="dropdown-toggle">
<i class="fas fa-user"></i>
FDR
</a>
<ul class="collapse list-unstyled" id="adminSubmenu">
<li>
<a href="fpo-profile.html"><i class="fa fa-arrows-alt" aria-hidden="true"></i> FPO Profile</a>
</li>
....
</ul>
</li>
<li>
<a href="#fisSubmenu" data-toggle="collapse" aria-expanded="false" class="dropdown-toggle">
<i class="fas fa-user"></i>
FIS
</a>
<ul class="collapse list-unstyled" id="fisSubmenu">
<li>
<a href="fpo-profile.html"><i class="fa fa-arrows-alt" aria-hidden="true"></i> FPO Profile</a>
</li>
....
</ul>
</li>
...
</ul>
</nav>
<button type="button" id="sidebarCollapse" class="btn btn-info">
<i class="fas fa-align-left"></i> &
<span>KANCHI</span>
</button>
Regarding the JS part:
<script type="text/javascript">
$(document).ready(function () {
$('#sidebarCollapse').on('click', function () {
$('#sidebar').toggleClass('active');
});
});
</script>
The current code toggles the entire sidebar. When I tried replacing ('#sidebar') with ('#demo'), it did not toggle as expected. I used 'demo' as the ID in the menu ul section.