1

I am confused by the steps on how to post code on stackoverflow. Please look at codepen for entire code:

Codepen

        const hamburger = document.querySelector(".hamburger");
        const navMenu = document.querySelector(".nav-menu");

        hamburger.addEventListener("click", () => {
            hamburger.classList.toggle("active");
            navMenu.classList.toggle("active");         
        })

        document.querySelectorAll(".nav-link").forEach(n => n.addEventListener("click", () => {
            hamburger.classList.remove("active");
            navMenu.classList.remove("active");
        }))

Sorry, trying to learn by playing with html, css, and javascript from scratch. I was wondering how to build a hamburger menu from scratch. Looked up some tutorial on youtube. Copied the code. The hamburger menu is clickable and changes to a drop down navigation bar. And clicking it again, returns it back to a hamburger menu. Developer tool shows the hamburger class changes to hamburger active then back to hamburger class. But when I added the grid container code under the navbar class, the hamburger menu no longer responds to clicks. I don't know why it no longer toggle to active. Can someone please explain. Thanks.

  • Validate your markup, it looks like an error from your end. Where `textarea` was missing an `>` at the end. – James Apr 08 '22 at 21:20

1 Answers1

1

It's a tipo error:

<textarea id="descript" name="description" placeholder="detail description*" rows="1" column="8"> </textarea>

You must close the "<textarea"

Victor
  • 2,313
  • 2
  • 5
  • 13
  • Thanks! Hmm... it doesn't seem like codepen indicate typos like forgetting to close the tag. I will code in VSC next time. – user17958456 Apr 09 '22 at 03:08