Reputation: 175
<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>
I want to show only this rows, which have
<td>True</td>
and additionally I want to remove "Show in table" column from finally html file. How can I do it in jquery or javascript?
Upvotes: 0
Views: 117
Reputation: 36703
// 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();
Upvotes: 1
Reputation: 82231
You can use contains selector:
$('tr:contains("Show in table")').remove();
and
$('tr:contains("True")').hide();
Upvotes: 3