0
I am making an administrator panel where you have the following options of Buttons
Dashboard class="dashboard-button"
Settings class="settings-button"
Contents class="contents-button"
Feedback class="feedback-button"
They all have the same id id="options"
And when you click on akgum button, a Nav appears below with the link options
And my jquery is like this
$(".dashboard-button").click(function(){
$(".navbar-dashboard").addClass("active");
});
Obs the class navbar-dashboard
is the one that will appear when you click the button
Already the class active
is the one with the css display bloxk
because initially the navbar has None display
Summarizing what I want is, by clicking the button, the navbar appears And if the user clicks the same button again, it disappears
Could someone enlighten me? I’m at a time cracking my head to find a solution kkkkk
from what I understand it is enough for you to replace the addClass("active") method with toggleClass("active")
– Gabriel José de Oliveira
The global attribute
id
defines an identifier for an element, should be unique and unique throughout the document.MDN Webdocsid
– Augusto Vasques