Using new v1.1.4 :has() syntax ...

$('#rank-products table.product-table
tr:has(table)>:first-child').addClass(....);

Excellent!

Come to think of it, this approach is possible with the deprecated syntax, too:

$('#rank-products table.product-table tr[table]>:first- child').addClass(....);


--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Aug 25, 2007, at 3:56 AM, Wizzud wrote:




Brandon-38 wrote:


Ugh. LOL.  I think I'll just change the DOM, it may be easier that
way.  Thanks, Karl.

Brandon

On Aug 24, 10:13 pm, Karl Swedberg <[EMAIL PROTECTED]> wrote:
On Aug 24, 2007, at 9:52 PM, Brandon wrote:





Here's the basic HTML:
<snip>
the :first-child matches the child table as well, which won't work for
me.  Is there a way to exclude nested tables?

-Brandon

Well, technically it's matching the table cell within the the child
table, not the child table. But I get what you're saying.

To avoid that, you could add a filter that checks to see if the <td>
has only one ancestor <table> element (in other words, the <td> isn't
in a nested table). Try this:

jQuery('#rank-products td:first-child').filter(function() {
   return $(this).parents('table').length == 1;

}).addClass('rank-handle');

- Karl




--
View this message in context: http://www.nabble.com/Broken-Selector- Help-tf4326055s15494.html#a12323989
Sent from the JQuery mailing list archive at Nabble.com.


Reply via email to