jQuery Hiding element based on previous row td value
<p>I have a table like this:</p>

<pre><code>&lt;table&gt;
    &lt;tr&gt;
        &lt;td&gt;
            &lt;a href="/payinvoice/1"&gt;Pay Invoice 1&lt;/a&gt;
            &lt;span class="paid hidden"&gt;False&lt;/span&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;
            &lt;a href="/payinvoice/2"&gt;Pay Invoice 2&lt;/a&gt;
            &lt;span class="paid hidden"&gt;False&lt;/span&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p>and I need to hide the Pay Invoice 2 link if the value of the span in the previous row td is False. </p>

<p>I came up with this:</p>

<pre><code>$('span.paid').each(function () {
    if ($(this).prev("span.paid").text() == "False") {            
        $(this).prev("a").addClass("hidden");
    }
});
</code></pre>

<p>but it doesn't work. Any tips? Thanks!</p>
