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

177
Views
Una pestaña abierta a la vez para acordeón

Tengo este acordeón abriendo todas las pestañas al mismo tiempo, pero quiero que abra una pestaña a la vez y cuando haces clic en otra pestaña, cierra la pestaña anterior. Traté de jugar con el javascript, pero lo único que puedo obtener es que la pestaña no se abre por completo.

 var acc = document.getElementsByClassName("accordion"); var i; for (i = 0; i < acc.length; i++) { acc[i].addEventListener("click", function() { this.classList.toggle("active"); var panel = this.nextElementSibling; if (panel.style.maxHeight) { panel.style.maxHeight = null; } else { panel.style.maxHeight = panel.scrollHeight + "px"; } }); }
 <button class="accordion">Section 1</button> <div class="panel"> <p>CONTENT 1</p> </div> <button class="accordion">Section 2</button> <div class="panel"> <p>CONTENT 2</p> </div> <button class="accordion">Section 3</button> <div class="panel"> <p>CONTENT 3.</p> </div>

about 4 years ago · Juan Pablo Isaza
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!