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

112
Visualizações
Removing an empty "Row" for a Grid of Nested Divs (not an html table) with JS / jQuery

I made this function to remove rows being looped into in a spec table view when all the cells in that row contain "N/A" instead of a spec. For reasons not worth going into, I need to change my table view from an HTML table to a fake table (html grid) with nested divs. This means that the specs are no longer connected by the tr tag, so I'm not sure how I can connect them to accomplish the same result...

  $('.specnacheckrow').each(function() { // for each row in the table
    var naTrue = 0;
    var totalCells = 0;
    var $this = $(this);

    totalCells = $this.find('.specnacheckcell').length //count how many cells
    naTrue = $this.find('.specnatrue').length //count how many <span class="specnatrue">N/A</span>

    if (naTrue < totalCells) { //if the number of cells is greater than the number of N/A's
      $this.show(); //show the row
    } else {
      $this.remove(); //else, hide the entire row - this includes the spec label at the beginning of the row.
    }

  });

Example of original table - https://codepen.io/genopeppino/pen/PojMero

Example of Grid Divs - https://codepen.io/genopeppino/pen/oNwKyNJ

You can see that in the original table the "Ship Weight - KG" row is correctly removed by the function above.

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