Reset hidden items from previous search
<p>I am trying to implement search in Javascript for my application, and I'm running into an issue where items I previously hid will not show up again. <a href="http://jsfiddle.net/for3v3rforgott3n/Y5w5r/9/" rel="nofollow">JSFiddle</a></p>

<p>My code is here:</p>

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

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

<p>The problem is I am hiding the parent srcprojects container of my filtered selection, so keyup doesn't show it again.</p>

<p>However, if I change</p>

<pre><code>$searchproject.show().filter(function() {
</code></pre>

<p>to </p>

<pre><code>$searchproject.parents('div.srcprojects').show().filter(function() {
</code></pre>

<p>it does not work at all. What am I doing wrong?</p>
