Thanks my friend, works fine..however i'm finding difficulty
understanding the code for next time...Couldn't imagine opening
brackets and writing a filter straight away :not(:contains

On Oct 31, 5:04 am, mkmanning <michaell...@gmail.com> wrote:
> Try this:
>
> $("tr:not(:contains(Brown))").css("background-color", "Red");
>
> On Oct 30, 12:58 pm, Aaron Gusman <ict.aarongus...@gmail.com> wrote:
>
>
>
> > I have a table with 2 columns and four rows.  I am currently able to
> > highlight the row which contains a specific piece of text.  But what I
> > want to do is to highlight the rows that DO NOT have that piece of
> > text.  Here's the code:
>
> > This line highlights the row that contains a cell with the text
> > "Brown":
> >         var found = 
> > $("tr:has(td:contains('Brown'))").css("background-color",
> > "Red");
>
> > However, I do not want to highlight the row with the text but all the
> > others..so I tried this:
> >         var found = $("tr:has(td:contains('Brown'))");
> >         $("tr:not(found)").css("background-color", "Red").css("background-
> > color", "Red");
> > I thought the :not filter was supposed to invert the selection however
> > this does not work..all rows get highlighted.
>
> > Were am I wrong??  And how can I do this?  Here's the HTML just in
> > case you want to try it.
>
> > <table cellspacing="0" cellpadding="0">
> >   <tr>
> >     <th>English</th>
> >     <th>Italian</th>
> >   </tr>
> >   <tr>
> >     <td>White</td>
> >     <td>Bianco</td>
> >   </tr>
> >   <tr>
> >     <td>Yellow</td>
> >     <td>Giallo</td>
> >   </tr>
> >   <tr>
> >     <td>Brown</td>
> >     <td>Marrone</td>
> >   </tr>
> >   <tr>
> >     <td>Black</td>
> >     <td>Nero</td>
> >   </tr>
> > </table>
>
> > Thanks

Reply via email to