How to validate a number with format *** *** ****?
<p>I am using jquery and i am trying to validate a cell phone number or home number with the format ### ### ####. # being a place holder for a digit.</p>

<p>At the moment i am using number but that gives problems with spaces, and i'm using minlength 10 because all SA numbers are min 10 digits.</p>

<p>My code already looks as follows:</p>

<pre><code>// Validation of Form
function validateForm() {
    $('#frmMain').validate({
        rules: { 
                 TelNumber: { required: true, number: true, minlength: 10 }
                },
        messages: {
                TelNumber: { required: 'Tel number Required' }
               },

        submitHandler: function (form) {
            $('#btnSubmit').click();

        }
    });
}
</code></pre>

<p>Here i found a add on for a US Phone number, if some one could tel me how a US phone number looks maby i can just edit this:</p>

<pre><code>jQuery.validator.addMethod("phoneUS", function(phone_number, element) {
    phone_number = phone_number.replace(/\s+/g, ""); 
    return this.optional(element) || phone_number.length &gt; 9 &amp;&amp;
        phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
}, "Please specify a valid phone number");

$("#myform").validate({
  rules: {
    field: {
      required: true,
      phoneUS: true
    }
  }
});
</code></pre>
