jQuery form login issue
<p>Hey guys so basically I'm doing a normal jQuery login and I do some form validation. So basically the problem is I set a variable named no_errors = true and so when I do fill out all of the form I works fine until I add the if ( no_errors == true ) then when hit the submit button it refreshes the page which it isn't suppose to do. Anybody have any tips or ideas? Thanks </p>

<p>jQuery code</p>

<pre><code>&lt;script type='text/javascript' src='http://localhost/js/jquery.js'&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
    $(function () {
        var no_errors = true;

        function trimInput(input) {
            return $.trim(input);
        }

        function doError(div) {
            $("#" + div).css("color", "red");
            $("#" + div).css("background", "#F59FC1");
            $("#" + div).css("border", "1px dotted #FF1C1C");
        }

        function doSuccess(div) {
            $("#" + div).css("color", "green");
            $("#" + div).css("background", "#94FFA8");
            $("#" + div).css("border", "1px solid #00FF2F");
        }
        $("#signin").submit(function () {
            if (!trimInput($("#username").val())) {
                doError("username");
                no_errors = false;
            } else {
                doSuccess("username");
            }
            if (!trimInput($("#password").val())) {
                doError("password");
                no_errors = false;
            } else {
                doSuccess("password");
            }
            if (no_error == true) {
                $("#e_c").html("Were good here!");
            }
            return false; //Stops the page from refreshing.
        });
    });
&lt;/script&gt;
</code></pre>

<p><em><strong>UPDATE</em></strong></p>

<p>I messed it up, instead of if (no_error == true) its if(no_errors == true) I missed an s :P common mistake I hope xD. </p>
