jQuery hide all table rows which contain a hidden field matching a value
<p>Though I don't doubt this has been answered I cannot find a great match for my question.</p>

<p>I have a table for which I'd like to filter rows based on whether or not they contain a hidden field matching a value.</p>

<p>I understand that the technique tends to be "show all rows", "filter the set", "show/hide that filtered set"</p>

<p>I have the following jquery but I'm aweful with filter and my filtered set seems to always contain no elements.</p>

<p>my table is the usual</p>

<pre><code>&lt;table&gt;
&lt;tr&gt;&lt;td&gt;header&gt;&lt;/td&gt;&lt;td&gt;&amp;nbsp;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;a visible cell&lt;/td&gt;&lt;td&gt;&lt;input type='hidden' id='big-asp.net-id' value='what-im-filtering-on' /&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p>My goal is to be able to match on tr who's descendent contains a hidden input containing either true or false.</p>

<p>this is how I've tried the selector (variations of this) and I'm not even testing for the value yet.</p>

<pre><code>function OnFilterChanged(e){
    //debugger;
    var checkedVal = $("#filters input[type='radio']:checked").val();
    var allRows = $("#match-grid-container .tabular-data tr");
    if(checkedVal=="all"){        
         allRows.show();
    }
    else if(checkedVal=="matched"){
         allRows.show();
         allRows.filter(function(){$(this).find("input[type='hidden'][id~='IsAutoMatchHiddenField']")}).hide();

    }
    else if(checkedVal=="unmatched"){

    }
}
</code></pre>

<p>Am I way off with the filter?  is the $(this) required in the filter so that i can do the descendant searching?</p>

<p>Thanks kindly</p>

<p>Building upon those great suggestions below I have found that the following does the trick.  I'd missed the fact that the filter closure function must return true/false based on the filter condition. Also, that the ends-with selector is great for asp.net generated ids based on INamingContainer</p>

<pre><code>allRows.show();
allRows.filter(function(){
            return $(this).find(
               "input[type='hidden'][id$='IsAutoMatchHiddenField']").val() == "False";
         }).hide();
</code></pre>
