2011-03-23 34 views
1
<table class="Table"> 
    <thead class="thead"> 
     <tr class="tr"> 
      <th class="th header">Done</th> 
      <th class="th header">None</th> 
      <th class="th header">None</th> 
      <th class="th header">Done</th> 
      <th class="th header">None</th> 

      <tr> 
       <td>info</td> 
       <td>info</td> 
       <td>info</td> 
       <td>info</td> 
       <td>info</td> 
      </tr> 
     </tr> 
    </thead> 
</table> 

我想删除所有 “无” S细胞和细胞如何从此表中删除所有单元格?

http://jsfiddle.net/D6e4H/

任何想法的所有 “信息”?

+0

嗯。所以你想要一个由Done |组成的表格完成了吗? – kapa 2011-03-23 07:41:31

+1

查看http://api.jquery.com/contains-selector/ – frictionlesspulley 2011-03-23 07:43:26

+0

上载?点击? – Vamsi 2011-03-23 07:44:28

回答

2

使用本

$(".th:contains('None')") .remove(); 
    $("td:contains('info')") .remove(); 

你的jsfiddle已更新。

+0

OP不想删除所有的信息'td'。多么独特的答案。哇 – Starx 2011-03-23 07:49:36

2

我认为你正在寻找这个

$("th:contains('None')").each(function(index,value) { 
    //Grab all the "None" th and their indexes 
    $("tr td:nth-child("+$(this).index()+")").remove(); 
    //remove the td with the same indexes on the next tr 
    $(this).remove(); 
    // now also remove the "None" th 
}); 

这是你的Solution

1

您正在寻找的:包括()选择。

$('th:contains("None")').remove(); 
$('td:contains("info")').remove(); 
相关问题