document.querySelectorAll(".topnav a.icon").forEach(a => { a.onclick = (event) => { var nav = document.querySelector('.topnav nav') nav.style.display = nav.style.display === 'block' ? 'none' : 'block' event.preventDefault() event.stopPropagation() } })