Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

174
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda