TextBox validation is empty or 11 digits
<p>I have a textbox in my form which must be validated only if is empty or contains 11 digits. 
I tried every solution found on internet but nothing happens.</p>

<pre><code>&lt;script type="text/javascript"&gt;
    $(document).ready(function() {
        $('#ctl00_CPH1_tax_id').attr("placeholder", "1234567890");
        $('#ctl00_CPH1_citizen_id').attr("placeholder", "12345678901");
        $('#ctl00_CPH1_e_posta').attr("placeholder", "ahmet.mehmet@sirket.com.tr");

        //var isbp = $('#ctl00_CPH1_IsBP');
        var name = $('#ctl00_CPH1_name').val();
        var code = $('#ctl00_CPH1_code').val();
        var dropdownlist2 = $('select:first');
        var tax_id = $('#ctl00_CPH1_tax_id').val();
        var citizen_id = $('#ctl00_CPH1_citizen_id').val();
        var email1 = $('#ctl00_CPH1_e_posta').val();
        var isbp = $('input[type=checkbox]:first');
        var dropdownlist1 = $('select:last');
        var isactive = $('input[type=checkbox]:last');
        //var dropdownlist1 = $('#ct100_CPH1_DropDownList1');
        var tax_id_check = /^\d{10}$/.test(tax_id);
        var citizen_id_check = /^$|^\d{11}$/.test(citizen_id);

        var email1_check = /^[a-zA-Z0-9._]+@([a-zA-Z0-9.]|[a-zA-Z0-9]+\-[a-zA-Z0-9.])+\.[a-zA-Z]{2,6}$/.test(email1);
        dropdownlist1.attr("disabled", "disabled");
        isactive.attr("disabled", "disabled");

        $(isbp).click(function(e) {
            if (isbp.is(':checked')) {
                dropdownlist1.removeAttr("disabled");
                isactive.removeAttr("disabled");
            }
            else {
                isactive.attr("disabled", "disabled");
                dropdownlist1.attr("disabled", "disabled");
            }
        });

        $("#ctl00_CPH1_Button1").click(function(e) {
            //console.log(drop2);
            //var name_status = /^[a-zA-Z][a-zA-Z]*$/.test(name);
            //var code_status = /^[a-zA-Z][a-zA-Z]*$/.test(code);
            //var IsBP = $('#ctl00_CPH1_IsBP');
            //if (name.length &lt; 3 || name_status == false) {
            //    e.preventDefault();
            //    alert('İsim sadece karakterlerden oluşmalı ve en az iki karakter olmalı!');
            //}
            //if (code.length &lt; 3 || code_status == false) {
            //    e.preventDefault();
            //    alert('Soyisim sadece karakterlerden oluşmalı ve en az iki karakter olmalı!');
            //}
            if (name.length == 0) {
                e.preventDefault();
                alert("İsim girilmedi!");
            }
            if (code.length == 0) {
                e.preventDefault();
                alert("Şirket Kodu girilmedi!");
            }
            if (dropdownlist2.val() == 0) {
                e.preventDefault();
                alert("Ülke seçilmedi!");
            }
            if (citizen_id.length != 0) {
                e.preventDefault();
                alert("Vatandaşlık numarası onbir haneli olmalı!");
            }
            if (tax_id.length == 0) {
                e.preventDefault();
                alert("Vergi numarası girilmedi!");
            }
            else if (!tax_id_check) {
                e.preventDefault();
                alert("Vergi numarası on haneli olmalı!");
            }

            if (email1 != "" &amp;&amp; !email1_check) {
                e.preventDefault();
                alert("E-Posta geçerli değil!");
            }
            if (isbp.is(':checked') &amp;&amp; dropdownlist1.val() == 0) {
                e.preventDefault();
                alert("İş ortağı tipi seçilmedi!");
            }
        });
    });
</code></pre>

<p>
This is my script and aspx follows:</p>

<pre><code>    &lt;form id="form1" runat="server"&gt;
&lt;div&gt;
&lt;center&gt;
    &lt;table&gt;
        &lt;tr&gt;
            &lt;td colspan="3" align="center"&gt;
                Şirket Giriş Ekranı&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td colspan="3"&gt;&amp;nbsp;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td align="left"&gt;
                &lt;asp:Label ID="Label1" runat="server" Text="İsim"&gt;&lt;/asp:Label&gt;
            &lt;/td&gt;
            &lt;td colspan="2"&gt;
                &lt;asp:TextBox ID="name" runat="server"&gt;&lt;/asp:TextBox&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td align="left"&gt;
                &lt;asp:Label ID="Label2" runat="server" Text="Şirket Kodu"&gt;&lt;/asp:Label&gt;
            &lt;/td&gt;
            &lt;td colspan="2"&gt;
                &lt;asp:TextBox ID="code" runat="server"&gt;&lt;/asp:TextBox&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td align="left"&gt;
                &lt;asp:Label ID="Label3" runat="server" Text="Ülke"&gt;&lt;/asp:Label&gt;
            &lt;/td&gt;
            &lt;td class="style4" colspan="2"&gt;
                &lt;asp:DropDownList ID="DropDownList2" runat="server" 
                    onselectedindexchanged="DropDownList2_SelectedIndexChanged"&gt;
                &lt;/asp:DropDownList&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td align="left"&gt;
                &lt;asp:Label ID="Label4" runat="server" Text="Vergi No"&gt;&lt;/asp:Label&gt;
            &lt;/td&gt;
            &lt;td colspan="2"&gt;
                &lt;asp:TextBox ID="tax_id" runat="server"&gt;&lt;/asp:TextBox&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td align="left"&gt;
                &lt;asp:Label ID="Label5" runat="server" Text="Vergi Dairesi"&gt;&lt;/asp:Label&gt;
            &lt;/td&gt;
            &lt;td colspan="2"&gt;
                &lt;asp:TextBox ID="tax_office" runat="server"&gt;&lt;/asp:TextBox&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td align="left"&gt;
                &lt;asp:Label ID="Label6" runat="server" Text="Vatandaşlık No"&gt;&lt;/asp:Label&gt;
            &lt;/td&gt;
            &lt;td colspan="2"&gt;
                &lt;asp:TextBox ID="citizen_id" runat="server"&gt;&lt;/asp:TextBox&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td align="left"&gt;
                &lt;asp:Label ID="Label7" runat="server" Text="Adres"&gt;&lt;/asp:Label&gt;
            &lt;/td&gt;
            &lt;td colspan="2"&gt;
                &lt;asp:TextBox ID="address" runat="server"&gt;&lt;/asp:TextBox&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td align="left"&gt;
                &lt;asp:Label ID="Label14" runat="server" Text="E-posta"&gt;&lt;/asp:Label&gt;
            &lt;/td&gt;
            &lt;td colspan="2"&gt;
                &lt;asp:TextBox ID="e_posta" runat="server"&gt;&lt;/asp:TextBox&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td align="left"&gt;
                &lt;asp:Label ID="Label15" runat="server" Text="Telefon"&gt;&lt;/asp:Label&gt;
            &lt;/td&gt;
            &lt;td colspan="2"&gt;
                &lt;asp:TextBox ID="telefon" runat="server"&gt;&lt;/asp:TextBox&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td align="left"&gt;
                &lt;asp:Label ID="Label16" runat="server" Text="Fax"&gt;&lt;/asp:Label&gt;
            &lt;/td&gt;
            &lt;td colspan="2"&gt;
                &lt;asp:TextBox ID="faks" runat="server"&gt;&lt;/asp:TextBox&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td align="left"&gt;
                &lt;asp:Label ID="Label10" runat="server" Text="İş Ortağım"&gt;&lt;/asp:Label&gt;
            &lt;/td&gt;
            &lt;td colspan="2"&gt;
                &lt;asp:CheckBox ID="IsBP" runat="server" oncheckedchanged="IsBP_CheckedChanged"/&gt; &lt;!--AutoPostBack="true"--&gt; 

                &lt;asp:Label ID="Label11" runat="server" Text="Evet"&gt;&lt;/asp:Label&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td align="left"&gt;
                &lt;asp:Label ID="Label12" runat="server" Text="İş Ortağı Tipi"&gt;&lt;/asp:Label&gt;
            &lt;/td&gt;
            &lt;td&gt;
                &lt;asp:DropDownList ID="DropDownList1" runat="server" 
                    onselectedindexchanged="DropDownList1_SelectedIndexChanged"&gt;
                &lt;/asp:DropDownList&gt;
            &lt;/td&gt;
            &lt;td&gt;
                &lt;asp:CheckBox ID="IsActive" runat="server" 
                    oncheckedchanged="IsActive_CheckedChanged" /&gt;
                &lt;asp:Label ID="Label13" runat="server" Text="Aktif"&gt;&lt;/asp:Label&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td colspan="3"&gt;&amp;nbsp;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;
                &lt;asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="Geri" /&gt;
            &lt;/td&gt;
            &lt;td colspan="2" align="center"&gt;
                &lt;asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Kaydet" /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/table&gt;
    &lt;br /&gt;
&lt;/center&gt;
&lt;/div&gt;
&lt;/form&gt;
</code></pre>

<p>I tried jquery older versions like 1.8.3 which is stable instead of 1.9.1
Also jquery.validate. 
When I run the code on chrome and inspect element on console everything runs properly.
But my code does not show any alerts.
"==" works but "!=" or ">" not.
Thanks in advance!
not working textboxes are e_mail and citizen_id. other textboxes work properly.</p>
