title: Phone Validation is not working properly
body: <p>I'm using this code for validating the phone number:</p>
  
  <pre><code>&lt;script&gt;
  $("#Phone").keydown(function (e) {
        // Allow: backspace, delete, tab, escape, enter and .
  
        if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
          // Allow: Ctrl+A
          (e.keyCode == 65 &amp;&amp; e.ctrlKey === true) ||
          // Allow: home, end, left, right, down, up
          (e.keyCode &gt;= 35 &amp;&amp; e.keyCode &lt;= 40)) {
  
  
  
          // let it happen, don't do anything
          return;
        }
        // Ensure that it is a number and stop the keypress
        if ((e.shiftKey || (e.keyCode &lt; 48 || e.keyCode &gt; 57)) &amp;&amp; (e.keyCode &lt; 96 || e.keyCode &gt; 105)) {
          e.preventDefault();
        }
      });
  
  
          var val = Phone.value
  if (/^\d{11}$/.test(val)) {
      // value is ok, use it
  } else {
      alert("Invalid number; must be eleven digits")
      Phone.focus()
      return false
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>I want the user to input only 11 digits and if it doesn't, it alerts user that they have to input 11 digits and sets the value to null.</p>
  
  <p>The problem is, when it alerts that the number is less than 11 digits, it doesn't set the value to null.</p>