US phone number validation for four textbox with extension[optional] using jquery validate.js
<p>I have one form which contains four textbox phone,phone1,phone2 &amp; ext. For validation I used jquery validate.js. Its working fine but one issue is there, its allowing invalid numbers also like 000-000-0000 or 001-000-0000   </p>

<p><em><strong>Below is my script for validation:</em></strong></p>

<pre><code>$params['rules'][$phone] = {"required": true,"minlength": 3,"digits":true };
$params['messages'][$phone] = {"required":"&lt;div class='error-message'&gt;*This is required &lt;/div&gt; &lt;div class='error-arrow'&gt;&lt;/div&gt; ",
"minlength":"&lt;div class='error-message'&gt;*  Numbers should be 3 digits&lt;/div&gt; &lt;div class='error-arrow'&gt;&lt;/div&gt;","digits":" &lt;div class='error-message'&gt;* Numbers only&lt;/div&gt; &lt;div class='error-arrow'&gt;&lt;/div&gt; "};


$params['rules'][$phone2] = {"required": true,"minlength": 3,"digits":true };
$params['messages'][$phone2] = {"required":"&lt;div class='error-message'&gt;* This is required&lt;/div&gt; &lt;div class='error-arrow'&gt;&lt;/div&gt; ",
"minlength":"&lt;div class='error-message'&gt;*  Numbers should be 3 digits&lt;/div&gt; &lt;div class='error-arrow'&gt;&lt;/div&gt;",
"digits":" &lt;div class='error-message'&gt;* Numbers only&lt;/div&gt; &lt;div class='error-arrow'&gt;&lt;/div&gt; "};
</code></pre>
