tags:

views:

34

answers:

2

Hi i want to remove the following

<tr><td style="padding-left:20px;" class="content">

This works fine with

$(".content").first().remove();

But on some of my pages I have this

<tr class="dgItem"><td class="content">

And it gets removed. Is it possible to make the JQuery only select the first example?

+6  A: 

Try this:

Example: http://jsfiddle.net/7c7kD/

$('tr:not(.dgItem) > td.content').remove();

Using jQuery's :not() selector, this will remove td.content elements that are a direct child of a <tr> that does not have the class .dgItem.

patrick dw
Your description is a little off, but the answer is correct... It removes `td.content` elements that are direct children of a `tr` that is **not** `.dgItem`. +1
gnarf
@gnarf - Very true. Thanks for the heads up! :o)
patrick dw
Thanks alot :-)
gulbaek
@gulbaek - You're welcome. :o)
patrick dw
+1  A: 

Why not just add a second class name to the first type of table column class="content anotherclassname"? then call $(".anotherclassname").remove();

Byron Cobb
Don't have direct access to the source code :-(
gulbaek