tags:

views:

31

answers:

3

I have a table where each row is clickable. Some columns in this table have links in them. I'd like to exclude 'link' columns from jQuery selection.

My first column, and third column contains links, so I'm doing the following after iterating through each row in the table:

row.children('td:gt(2)') // for column 3+
row.children('td:lt(2)') // for columns 0 and 1

Is there any way to join these two lines?

A: 

This works:

row.children('td:gt(2),td:lt(2)')
artlung
+1  A: 
row.children('td:gt(2), td:lt(2)')

edit: ah, artlung beat me to it.

Corey
A: 

You could also use the :not with :eq selector...

row.find('td:not(:eq(2))')

or :not with the :nth-child selector

row.children('td:not(:nth-child(3))')

*NOTE: :eq index starts with zero while the :nth-child selector starts with one.

I was going to use children for the :eq selector example, but it only worked on the first row.

fudgey