title: Jquery form validation - telephone number
body: <p>I have setup jQuery validation on form, The validation currently tests that the telephone number field isn't empty and is a number, but I'd like it to be able to handle a user placing a space after the mobile/area code.</p>
  
  <p>Can anyone advise what i'd need to do to allow this?</p>
  
  <p>This is my current code -  </p>
  
  <pre><code>if((phone.length == 0) || (names == 'Please Enter Your Contact Number (no space)')){  
          var error = true;  
          $('.error').fadeIn(500);  
          $('.pStar').fadeIn(500);
  
      }else{  
          var value = $('#phone').val().replace(/^\s\s*/, '').replace(/\s\s*$/, '');
          var intRegex = /^\d+$/;
          if(!intRegex.test(value)) {
               var error = true;  
               $('.error').fadeIn(500);  
              $('.pStar').fadeIn(500);
  
          } else{
          $('.pStar').fadeOut(500);
          }
      }   
  </code></pre>