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:
$("tr td:contains('test')").each(function(){ $(this).siblings('td.ms-vb-icon').css("visibility","hidden"); });
Demo here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With