Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 977843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:58:04+00:00 2026-05-16T03:58:04+00:00

So I have this (huge) table , classed with css (big_conv_tbl) . All empty

  • 0

So I have this (huge) table , classed with css (big_conv_tbl) . All “empty” cells have a &nbsp inside them , I’m also using an odd/even css script to make the table easier to read (and thus some “empty” cells have a gray background color) .

What I want is to remove the borders and the background-color (set it to white) if the cell is “empty” (in my case if it contains “&nbsp”) . Empty-cell:hide does not work .

I wrote a simple jquery script but it doesn’t work :

$(".big_conv_tbl tr").each(function() {                           

var VC = $(this).find("td").html().trim();                          

if (VC == ''){                 
    $(this).css('background-color','white');
}             
});

What am I doing wrong ?
I have no classes set for td’s , only for rows (odd/even) . Please don’t make me class every TD , the table is bloody huge . I appreciate any help

le :

Thanks Nick , I had to edit (not enough char. in comment) .

Here is a simple html page with a small table . For some reason it just won’t work

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" >
$(".big_conv_tbl tr td").each(function() {
  if ($.trim($.text([this])) == '') {
    $(this).css('background-color','white');
  }
});
</script>


</head>


<body>
<table width="100%" border="1" class="big_conv_tbl" bgcolor="#999999">
  <tr>
    <td>asdsads</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>sagasag</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>sagsagsagsag</td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T03:58:05+00:00Added an answer on May 16, 2026 at 3:58 am

    Instead of looping for the row, you need to loop over each cell, like this:

    $(function() { //so it runs when the DOM is ready
      $(".big_conv_tbl tr td").each(function() {
        if ($.trim($.text([this])) == '') {
          $(this).css('background-color','white');
        }
      });
    });
    

    In this case we’re using $.trim() on the $.text() of the object, rather than the .html() (which would still have content (the "&nbsp;"). $.text() is just a more efficient way to get the text out, since we don’t need to create another jQuery object here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using MS SQL. I have a huge table with indices to make this
I have a huge table - 36 million rows - in SQLite3. In this
I have a huge table, the number of cells can reach a little above
I have a huge table in my database that contains distances between cities. This
I have this huge domain object(say parent) which contains other domain objects. It takes
i have this dictionary: a) 2012 UN NEWNW = ( 2012/06/04 Saudi Arabia Huge
I have a huge problem with this method im trying to make. I have
I have a huge string that looks like this: Text Text Text Text Text
I had a huge file for creating this GUI and I have shortened it
I have a huge autocomplete field with a list of exams. This field prepends

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.