Thanks Ian, it seem to be working perfectly. I just have one more
question: isn't there a big performance impact using this piece of
code? It looks like the page it taking a while do load, but I guess
you have to choose between the time the page takes to load and the
time you take to do everything manually.. am I right?

On Apr 28, 1:20 am, "Ian Struble" <[EMAIL PROTECTED]> wrote:
> Building on Karl's example and your new all-td's-must-be-empty
> requirement; mark all the TR's with a target class then sweep through
> the TD's and get rid of the target class if you find a td that is not
> empty.   Play around a bit and see what else you can come up with.
>
> Ian
> ----
>
> $(document).ready(function() {
>   $('tr').addClass('allEmptyTds');    // mark
>   $('td').each(function() {
>     var $this = $(this);
>     if ($this.html() !== '&nbsp;') {
>       $this.parent().removeClass('allEmptyTds');  // and sweep
>     }
>   });
>
> });
>
> On 4/27/07, Feed <[EMAIL PROTECTED]> wrote:
>
>
>
> > Feed wrote:
> > > Hello all, I'm getting used to the excellent jQuery library and I need
> > > some help of more experienced programmers. I have this simple table:
>
> > > <table class="table">
> > >       <tr>
> > >               <td>content</td>
> > >               <td>content</td>
> > >               <td>content</td>
> > >       </tr>
> > >       <tr>
> > >               <td>&nbsp;</td>
> > >               <td>&nbsp;</td>
> > >               <td>&nbsp;</td>
> > >       </tr>
> > >       <tr>
> > >               <td>content</td>
> > >               <td>content</td>
> > >               <td>content</td>
> > >       </tr>
> > > </table>
>
> > > What I need is to add a class to the TRs that have children TDs that
> > > have &nbsp; inside (and ONLY &nbsp;)... I'm having problems because
> > > &nbps; is not text, it's html code...
>
> > > Thanks in advance!
>
> > Thanks guys, that really helped, specially Karl Swedberg's piece of
> > code. The problem is: the class must only be applied to the TR only if
> > ALL children TDs have &nbsp; inside... I'm having a hard time making
> > it work, I'm still learning how to use jQuery properly.

Reply via email to