Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

119
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!