2016-04-04 13 views
0
<table> 
<tr><th>Content</th><th>Show in table</th></tr> 
<tr><td>ABC</td><td>True</td></tr> 
<tr><td>ABC</td><td>False</td></tr> 
</table> 

私はいくつかのデータを含むセルを含むテーブル行を削除するにはどうすればよいですか?

<td>True</td> 

を持っており、さらに、私は最終的には、HTMLファイルから「ショー表の」列を削除する場合にのみ、この行を、表示したいです。 jqueryやjavascriptでどうすればいいですか?あなたが使用することができます

答えて

3

は、セレクタが含まれています

$('tr:contains("Show in table")').remove(); 

$('tr:contains("True")').hide(); 
1
// First removes the rows which have false in second column 
$("tr").has("td:contains(False)").remove(); 

// Then remove the second column from the table. 
$("table tr td:eq(1), table tr th:eq(1)").remove(); 
関連する問題