Display alert when the user enters text in input area
<p>I am trying to display an alert when the user enters text into the search box but it does not work. Please guide. </p>

<p><a href="http://jsfiddle.net/zcH54/" rel="nofollow">http://jsfiddle.net/zcH54/</a></p>

<pre><code>&lt;div id="form" style="float:right;" &gt;
    &lt;form method="get" &gt;
    &lt;input type="submit" value="Search" class="btn" &gt;
    &lt;input name="q" type="text" id="search" size="32" maxlength="128" class="txt" &gt;
    &lt;/form&gt;
&lt;/div&gt;  &lt;!--form ends--&gt;
</code></pre>

<p>Here is the JS,</p>

<pre><code> $(document).ready(function() { 
                $("#search").keyup(function() {                                                         // function starts when a key is entered in the search bar
                    alert("I am an alert box!");
                });
     });
</code></pre>
