Im trying to use the code to create a sub nav menu and I thought I got a solution but I keep getting the error. Please someone inform me what I am missing thank you!
(P.S I know my code is prob not the best but please cut my a little slack I am just a 16 year old trying to make some money)
HTML
<div id="navSidepanel" class="sidepanel">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a href="#"><button class="openbtn" onclick="openNav(1)">Socials</button></a>
<a href="#">Services</a>
<a href="#">Clients</a>
<a href="#">Contact</a>
</div>
<button class="openbtn" onclick="openNav(0)">☰</button>
Javascript
function openNav(x) {
if(x = 0){
console.log("Opened first Nav")
document.getElementById("navSidepanel").style.width = "100%";
}
else {
document.getElementById("navSidepanel2").style.width = "100%";
}
}
/* Set the width of the sidebar to 0 (hide it) */
function closeNav() {
document.getElementById("navSidepanel").style.width = "0";
}