I have a table for which I am attempting to select all rows which have a td containing the text 'Test' and then hide the td with class 'ms-vb-icon' on all the matched rows
I intitally had the code below but this only hide the class on the last matched row
$("td:contains('test'):last").parent().children(".ms-vb-icon").css("visibility","hidden");
So I tried this but its not working...
$("tr:has(td:contains('test')").each(function(){
(this).children(".ms-vb-icon").css("visibility","hidden");
});
Simplified html look like this:
<table>
<tbody>
<tr>
<td class=ms-vb-icon></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>test</td>
</tr>
</tbody>
<table>
Try with
The class
.ms-vb-icon
is a child of thetr
while the$(this)
function refer to thetd
Try:
Demo here.
I guess you are missing ')' .It worked for me: