How to combine search in table by two input text fields?
<p>My table looks like this:</p>

<pre><code>&lt;table&gt;
   &lt;tr&gt;
      &lt;td&gt;Apple&lt;/td&gt;
      &lt;td&gt;Green&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
      &lt;td&gt;Grapes&lt;/td&gt;
      &lt;td&gt;Green&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr&gt;
      &lt;td&gt;Orange&lt;/td&gt;
      &lt;td&gt;Orange&lt;/td&gt;
   &lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p>The searching javascript as follows:</p>

<pre><code>var $rows = $('#table tr');
$('#search').keyup(function() {
    var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();

    $rows.show().filter(function() {
        var text = $(this).text().replace(/\s+/g, ' ').toLowerCase();
        return !~text.indexOf(val);
    }).hide();
});
</code></pre>

<p>Look at this example to understand my problem better:</p>

<p><a href="http://jsfiddle.net/7BUmG/4398/" rel="nofollow">http://jsfiddle.net/7BUmG/4398/</a></p>

<p>I filter table rows with the first input field. Then, when I use the second input field, results of first search are not included. How can I fix it?</p>