2012-11-17 57 views

回答

1

如果它们是相同的父的孩子,你可以使用nth-child选择对其进行过滤http://jsfiddle.net/T36Y8/这似乎是你的情况,因为你每个TR都要从第四个开始。

$('.CSSTableGenerator tr td').filter(":nth-child(4n)"); 

如果它们不相同的父的孩子,你可以只通过一个过滤功能http://jsfiddle.net/T36Y8/1/

$('.CSSTableGenerator tr td').filter(function(index){ 
    return index % 4 === 0; 
}) 
+0

是的,当然使用'.filter()',而不是填鸭式':第n-child'到主选择。出于兴趣,'.filter(“:odd”)。filter(“:odd”)'应该具有相同的效果,但我怀疑它有什么优势。 –

0

$( 'CSSTableGenerator TR')。每个(函数(){$(这个).find('td')。each(function ind(ind){if(ind == 3){//在这里做你的东西}})})

相关问题