2011-08-30 97 views
-1

如何选择除第一个TD之外的所有表格?我不知道有多少列有可能在该表中,所以我真的不能使用:第n个孩子(2)等等选择表格单元格w/jQuery

<table> 
<tr> 
    <td>do not select</td> 
    <td>select</td> 
    <td>select</td> 
    <td>select</td> 
    ... 
</tr> 
</table> 
+0

你是什么意思'选择all'? – Neal

+1

重复?即使阅读后,我不这么认为...... – santa

+0

不完全重复@Marek。相似,是的,重复?没有:) –

回答

3

试试这个使用:gt(0)其在选择所有元素索引大于匹配集内的索引。

$("table td:gt(0)"); 

工作demo

0

你可以一个类添加到您的TD的:

$('#someTable .tableCell').each(function() 
{ 
    alert($(this).html()); 
}); 
1
$('table tr td:first-child').siblings(); 
相关问题