0

i'm tryin' to make a pop-up navbar for tablet and mobile modes but i've got stuck on the javascript

<script>
const navbar = document.getElementById('navbar')
const popup = document.getElementsByClassName("menu-btn")

popup.addEventListener("click", show ());

function show() {
    navbar.classList.toggle('duh');
}

</script>
  • `getElementsByClassName` does not return an element but a `HTML Collection Object`! – tacoshy Sep 02 '22 at 18:51
  • Not the only problem, next check your add event listener function https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener – Honsa Stunna Sep 02 '22 at 18:53

0 Answers0