ASP.NET OnClientClick="return validate()" not working
<p>In the following aspx page, no matter how I call the OnClientClick="return validate()", the page will post back. The following is what I have tried and the results of each attempt:</p>

<p>OnClientClick="return true" ----- Successful Postback</p>

<p>OnClientClick="return false" ------ No Postback</p>

<p>OnClientClick="return validate()" ----- Successful even with bad input</p>

<p>OnClientClick="return validate()" ------ Successful with good input</p>

<p>OnClientClick="if (!validate()) {return false;}" ----- No Postback regardless of input</p>

<pre><code>&lt;!DOCTYPE html&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head runat="server"&gt;
&lt;script src="//code.jquery.com/jquery-1.12.0.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
    function validate() {
        $('input[type=text]').each(function () {
            if ($(this).val() === '' || $(this).val() === 'Required Field' || $(this).val() === 'Username' || $(this).val() === 'Password') {
                return false;
            } else {
                return true;
            }
        });
    }
    $(document).ready(function () {
        $('input[type=text]').focusin(function () {
            $(this).removeClass('Invalid');
            $(this).val('');
        }),
         $('input[type=text]').focusout(function () {

             if ($(this).val() === '') {
                 $(this).removeClass('Valid');
                 $(this).addClass('Invalid');
                 $(this).val('Required Field');
             } else {
                 $(this).addClass('Valid');
             }
         });
    });
&lt;/script&gt;
&lt;title&gt;&lt;/title&gt;
&lt;style type="text/css"&gt;
    .Invalid {
        border: 2px solid red;
        background-color: lightpink;
        color: red;
    }

    .Valid {
        border: 2px solid green;
        background-color: lightgreen;
        color: green;
    }
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;form id="frmLogin" runat="server"&gt;
        &lt;asp:TextBox ID="txtUser" runat="server" Text="Username"&gt;&lt;/asp:TextBox&gt;
        &lt;asp:TextBox ID="txtPassword" runat="server" Text="Password"&gt;&lt;/asp:TextBox&gt;
        &lt;asp:Button ID="btnSubmit" runat="server" Text="Login" OnClientClick="if (!validate()) {return false;}" OnClick="btnSubmit_Click" /&gt;
  &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>