I have the following line:
<li id="fecharMenu">
<i class="mdi mdi-window-close mdi-24px" id="iconFecharMenu"></i>
<a href="#"></a>
</li>
When the user clicks on <li id="fecharMenu">
, the menu closes and I would like to change the icon and consequently, the id of <li>
of <i>
, thus:
<li id="abrirMenu">
<i class="mdi mdi-menu mdi-24px" id="iconAbrirMenu"></i>
<a href="#"></a>
</li>
JavaScript that I currently have, it "closes" the menu only, I would like to change the icon and id of the li and the icon too, so you can create an event by clicking on the open menu button:
document.getElementById("fecharMenu").addEventListener("click", fecharMenu);
function fecharMenu() {
document.getElementById("barraLateral").style.width = "60px";
}
How could I only do with JavaScript, without using Jquery?