2
I have a class #sidebar-show which, when I click on it, I want you to remove the class d-None to show the div below. I am using Bootstrap.
What happens is when I click on #sidebar-show the class d-None is not removed.
NOTE: I would like to remove the d-None of Nav
$("#sidebar-show").click(function() {
$('#sidebar').removeClass("d-none");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="sidebar-mobile d-block d-sm-none" id="sidebar-show">
<i class="fas fa-bars"></i>
</div>
<nav class="d-none d-sm-block" id="sidebar">
<div class="sidebar-header">
<img src="logo-white.png" alt="">
</div>
<ul class="list-unstyled components">
<li>
<a href="#pageSubmenu" data-toggle="collapse" aria-expanded="false"><i class="fas fa-chart-line mr-2"></i> Métricas</a>
<ul class="collapse list-unstyled" id="pageSubmenu">
<li><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
</ul>
</li>
<li>
<a href="#"><i class="fas fa-cogs mr-2"></i>Configurações</a>
</li>
</ul>
</nav>
Here it worked perfectly. How did you verify that the class was not removed? You could elaborate a [mcve] by adding the class CSS code and correctly setting the "bars" button that receives the event (it is not visible in your example)?
– Woss