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

118
Vistas
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 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