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

81
Views
Necesito resolver este problema del menú desplegable

Aquí está mi código:

HTML:

 <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" href="C:\Users\gyld2\Documents\dropdown menu\dropdown.css"> </head> <body> <script type="text/javascript" src="C:\Users\gyld2\Documents\dropdown menu\dropdown.js"></script> <button id="btn">Click Here</button> <ul id="list"> <li>item</li> <li>item</li> <li>item</li> <li>item</li> </ul> </body> </html>

JS:

 const button = document.getElementById("btn"); const list = document.getElementById("list"); list.style.display = "none"; button.addEventListener("click",(event)=> { if (list.style.display == "none") { list.style.display = "block"; else { list.style.display = "none"; } } })

cómo se ve mi menú

y quiero que sea algo como esto:

cómo es cuando está cerrado.

cómo es cuando está abierto.

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

0

Error tipográfico

 if (list.style.display == "none") { list.style.display = "block"; } else { list.style.display = "none"; } 

 const button = document.getElementById("btn"); const list = document.getElementById("list"); list.style.display = "none"; button.addEventListener("click",(event)=> { if (list.style.display == "none") { list.style.display = "block"; } else { list.style.display = "none"; } })
 <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title></title> </head> <body> <button id="btn">Click Here</button> <ul id="list"> <li>item</li> <li>item</li> <li>item</li> <li>item</li> </ul> </body> </html>

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!