Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
js toggle menu
const toggleMenu = document.querySelector(".navigation button");
const menu = document.querySelector(".navigation ul");;
toggleMenu.addEventListener("click", function () {
const open = JSON.parse(toggleMenu.getAttribute("aria-expanded"));
toggleMenu.setAttribute("aria-expanded", !open);
menu.hidden = !menu.hidden;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.