onkeyup not working on hide()
<p>I'm trying to show and hide div contents depends on the input of the user.</p>

<p>Here are my codes:</p>

<pre><code>&lt;input type="text" name="pass" id="pass" onkeyup="check_input(this.value)"&gt;

&lt;div id="repeated_pattern" style="display:none"&gt;
    &lt;b&gt;REPEATED PATTERN&lt;/b&gt;
    &lt;p&gt;Repeated characters&lt;/p&gt;
&lt;/div&gt;

&lt;script&gt;
function check_input(value){
     //this would check if there are 3 or more characters repeated consecutively
     var repeat_pattern = /(.)\1\1/.test(value);  

     if(repeat_pattern)  { 
        $("#repeated_pattern").show(500); 
     }else{ 
        $("#repeated_pattern").hide(500); 
     }
}    
&lt;/script&gt;
</code></pre>

<p>Tests:</p>

<ol>
<li>When I try to input <code>gg</code>, the div contents did not show so the result is ok</li>
<li>When I try to input <code>ggg</code>, the div contents show so the result is ok</li>
<li>But when I try to remove the one <code>g</code> so it is now <code>gg</code>. It supposed to be the div contents must be hide but still it showing. <code>onkeyup</code> is not working properly with the <code>hide()</code> function. </li>
</ol>

<p>How to onkeyup work with hide() or vice versa?</p>
