I have a table like this:
<table>
<tr>
<td>
<a href="/payinvoice/1">Pay Invoice 1</a>
<span class="paid hidden">False</span>
</td>
</tr>
<tr>
<td>
<a href="/payinvoice/2">Pay Invoice 2</a>
<span class="paid hidden">False</span>
</td>
</tr>
</table>
and I need to hide the Pay Invoice 2 link if the value of the span in the previous row td is False.
I came up with this:
$('span.paid').each(function () {
if ($(this).prev("span.paid").text() == "False") {
$(this).prev("a").addClass("hidden");
}
});
but it doesn’t work. Any tips? Thanks!
1 Answer