Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

172
Vistas
Why the accordion is not working in this case?

I tried to make a accordion using HTML, CSS and JavaScript. The HTML and CSS is working well but the javaScript emplementation is not working. Can someone help me?

Files are here: https://drive.google.com/drive/folders/1nzEyyU_4QA4x_qh1QE_rz3V3DD_r7PAv?usp=sharing

I can't add code snippets because the stack overflow is not letting me submit the question.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Here is a working script for you. Replace this with your javascript.

Working example I made on Codepen: https://codepen.io/9to5disappear/pen/jOYBJJp

Javascript:

'use strict'

let label = document.getElementsByClassName('label');
let content = label.nextElementSibling;


const elements = document.querySelectorAll('.content');
Array.from(elements).forEach((element, index) => {
    element.parentElement.addEventListener('click', () => {
        element.classList.toggle('content-visible');
    })   
});
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda