I am trying to make a toggle menu and found this example(https://codemyui.com/responsive-sidebar-menu/) on Codepen. I would like to make the Jquery code into pure Javascript, but apparently there's something wrong with what I've written..
and this is what I've written(I made id for main and added Onclick function on the burger menu, that's the only 2 differences from the original):
function toggle(){
var main = document.getElementById("mymain");
var button = document.querySelectorAll(".button");
var sidebarItem = document.querySelectorAll(".sidebar-item");
main.classList.toggle("move-to-left");
button.classList.toggle("active");
sidebarItem.classList.toggle("active");
for(let i = 0; i < sidebarItem.length; i++){
sidebarItem[i].classList.toggle("active");
}
}