input.length check not working
<p>I try to implement the following code:</p>

<pre><code>&lt;div class="clear"id="usernameline"&gt;username:&lt;input type="text" name="username"   id="username" style="border:1px solid #928b8b;"&gt; (at least 3 character)&lt;/div&gt;
&lt;div id="usercheck"&gt;&lt;/div&gt;
&lt;input style="cursor:pointer;border:1px solid #ffffff;background:#c0c0c0;color:#484848" type="button" class="form_button" id="register" value="register!"&gt;

&lt;script&gt;
    var error1 = '&lt;span style="color:#ff0000"&gt;please fill in your username&lt;/span&gt;';
    var error2 = '&lt;span style="color:#ff0000"&gt;please insert at least 3 character&lt;/span&gt;';
    $("#register").click(function () {
        if ($("#username").val() == '') {
            $("#usercheck").show();
            $("#usercheck").html(error1);
        } else if ($("#username").val() != '') {
            var user = $("#username").val();
            if (user.length &lt;= 3) {

                $("#usercheck").html(error2);

            } else {

                $("#usercheck").hide();
            }
        }
    });       
&lt;/script&gt;
</code></pre>

<p>When I click register button, if the value length in the input box is larger than 3, <code>$("#usercheck").hide()</code> is not called, can anyone tell me what's wrong in my code, any help will be greatly appreciated.</p>
