title: javascript cell number validation
body: <p>I want to validate cell number using <strong>JavaScript</strong>.</p>
  
  <p>Here is my code.</p>
  
  <pre><code>if(number.value == "") {
      window.alert("Error: Cell number must not be null.");
      number.focus();
      return false;
  }
  
  if(number.length != 10) {
      window.alert("Phone number must be 10 digits.");
      number.focus();
      return false;
  }
  </code></pre>
  
  <p>Here is the issue, when I submit the form with out entering the phone number, it is showing the error cell number must not be null. it works fine. </p>
  
  <p>When I submit the form with cell number less than 10 digits, it is showing phone number must be 10 digits. It is also fine.</p>
  
  <p>The problem is when I submit the form with 10 digits, then also it is showing the error phone number must be 10 digits. </p>
  
  <p>Please help me.
  Thank You.</p>
  
  <p>And also need the validation code for only digits for cell number. </p>