How can I make the .nav show styles in .open after clicking #menu-icon?
Note: I used Bootstrap to create the nav
HTML
<!-- logo -->
<div class="logo">
<img src="assets/logo.png" alt="logo g's shop">
</div>
<i class="ri-menu-line" id="menu-icon"></i>
<!-- nav -->
<ul class="nav nav-pills nav-fill m4">
<li class="nav-item">
<a class="nav-link active .bg-white" aria-current="page" href="#">ALL ITEM</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">SMARTPHONES</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">LAPTOPS</a>
</li>
</ul>
CSS
.nav {
position: absolute;
z-index: 10001;
top: 65px;
right: 30px;
width: 270px;
background-color: #f3efef;
display: flex;
flex-direction: column;
justify-content: flex-start;
border-radius: 4px;
transition: all .50s ease;
font-size: 14px;
}
.nav-item {
margin-top: -2px;
border-radius: 4px;
}
#menu-icon {
display: block;
}
.nav .open {
left: 0;
}
JS
let menu = document.querySelector('#menu-icon');
let navbar = document.querySelector('.nav');
menu.addEventListener("click", function() {
navbar.classList.toggle('open');
});
I expect that ".nav .open" will work when I click the #menu-icon, preferably using jQuery instead of vanilla JS