I have a table with the following structure:
| abc|1 | def | ghi |
| erg|1 | asd | dfg |
| sdf|2 | ghj | erd |
| tsd|2 | sdf | hgj |
I now want to hide all tr
where the suffix |2
can be found in the first td
. So the result should be:
| abc|1 | def | ghi |
| erg|1 | asd | dfg |
This is my approach:
$('table tr').each(function() {
$(this).find("\\|2").hide();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
<tr>
<td>bla|1</td>
<td>sdf</td>
<td>hfgh</td>
</tr>
<tr>
<td>bla|1</td>
<td>3sf</td>
<td>gdfg</td>
</tr>
<tr>
<td>bla|1</td>
<td>sdf</td>
<td>jfhj</td>
</tr>
<tr>
<td>bla|2</td>
<td>sdf</td>
<td>hfgh</td>
</tr>
<tr>
<td>bla|2</td>
<td>3sf</td>
<td>gdfg</td>
</tr>
<tr>
<td>bla|2</td>
<td>sdf</td>
<td>jfhj</td>
</tr>
</table>
But that doesn't produce any result.