How to get element within element?
<p>I have a structure that looks like this:</p>

<pre><code>&lt;div class="project_group"&gt;
    &lt;table&gt;
        &lt;tr style="display:none"&gt;
            &lt;td&gt;...&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr style="display:none"&gt;
            &lt;td&gt;...&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;...&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/table&gt;
&lt;/div&gt;
</code></pre>

<p>I have many different project_group <code>div</code>s in the page. Now, I want to iterate over each of these divs and get a count of the visible <code>tr</code>s. If the count is 0, then I want to hide the whole div. </p>

<pre><code>$('div.project_group').each(function(index){
    if ($(this)[index].filter('table tr:visible').length &gt; 0)
    {
        $(this)[index].show();
    }
    else
    {
        $(this)[index].hide();
    }
})
</code></pre>

<p>The error message I get:</p>

<pre><code>Uncaught TypeError: Object #&lt;HTMLDivElement&gt; has no method 'filter'
</code></pre>
