Currently developing a website and in need of assistance with the mobile device navbar functionality. Essentially, I am looking to close the navigation when a specific link, such as "Destaques", is clicked. All I require is to remove the class "opened" upon any link click, as it is a single-page website with no redirects.
I have attempted to implement changes using the .click function and getElement by Id method, but have had no success. I am currently clicking on <a>
elements and aiming to alter the class of <nav>
from <nav class="nav1 opened"
to <nav class="nav1"
. Here is a snippet of the code I am working with.
<nav class="nav1" id="nav-mobile">
<a class="mobile_menu_close"></a>
<div class="container">
<div class="flex">
<ul class="nav1_links">
<li class="links-header"><a href="#contact"> Contact</a></li>
</ul>
</div>
</div>
</nav>
If anyone has a solution to this issue, I have already attempted approximately 20 different methods but have yet to find a satisfactory answer.