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

75
Visualizações
Issue with showing/hiding elements upon filter

I have a page with two filter groups: one for topic and one for format. The filter should select the associated cards and display them while preserving the respective section headers that the cards are in. If no results are found, a "no results" div is displayed.

I have it set up and this works for the most part. However, I noticed that in my "format" filter group* that only the first item preserves the group headings - the other filter items combine all the cards together while throwing in some random section headers. For the life of me, I can't figure out what's happening.

*I put everything in this Codepen here.

I'm not sure if it's getting thrown off somewhere because of this section using the parent reference?

$(".card").hide().filter($filteredResults).show();
  var all_hidden = true;
  $(".card").each(function (index) {
    if ($(this).is(":visible")) {
      all_hidden = false;
      $(this).parent().prev(".section-header").css("display", "block");
    } else {
      console.log("this happened");
      $(this).parent().prev(".section-header").css("display", "none");
    }
  });
about 4 years ago · Juan Pablo Isaza
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