Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

123
Views
Why is toggle active not working in the below code?

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.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It's a tipo error:

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

You must close the "<textarea"

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!