I have integrated Laravel 5.8 and Bootstrap 4 into my project using npm, and I have the toggle button in my blade file as shown below:
<button class="btn btn-primary" id="menu-toggle">Toggle Menu</button>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
In order to make the above toggle button work, I've included the following jquery code:
<script>
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
</script>
However, I am facing an issue where the toggle button does not function when clicked. How can I resolve this problem?