title: jQuery validation plugin issue not working for number field
body: <p>I am using a jQuery validation plugin and it's partially working. No issue with validating the email field (it shows both wrong emails when entered) but the phone number field is not getting validated.</p>
  
  <p>It shows the message "Please enter the mobile number" <strong>but not the "Please enter valid mobile number"</strong>.</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <pre class="lang-js prettyprint-override"><code>var $emailPreferenceForm = $('#email-preference__form');
  
  function emailPreferenceFormValidate() {
      $emailPreferenceForm.validate({
          rules: {
  
              emailaddress: {
                  required: true,
                  //email: true
                  myEmail: true
              },
              phonenumber: {
                  minlength: 10,
                  maxlength: 10,
                  digits: true,
                  myPhone: true
              }
          },
          messages: {
              emailaddress: "Please use a valid e-mail address",
              phonenumber: "Please enter the mobile number"
          }
      });
  }
  
  jQuery.validator.addMethod("myEmail", function(value, element) {
      return this.optional( element ) || ( /^[a-z0-9]+([-._][a-z0-9]+)*@([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,4}$/.test( value ) &amp;&amp; /^(?=.{1,64}@.{4,64}$)(?=.{6,100}$).*/.test( value ) );
  }, 'Please enter valid email address.');
  
  jQuery.validator.addMethod("myPhone", function(value, element) {
      return this.optional( element ) || /^[0-9]*$/.test( value );
  }, 'Please enter valid mobile number.');
  
  emailPreferenceFormValidate();
  
  /**/
  
  $("#email-preference__form input").on('click',function() {
  
      userPrefs_newsletters = $("input#newsletters_emailpref").is(':checked');
      userPrefs_newsletters_phone = $("input#newsletters_phonepref").is(':checked');
  
      userPrefs_lease_information = $("input#lease_information_emailpref").is(':checked');
      userPrefs_lease_information_phone = $("input#lease_information_phonepref").is(':checked');
  
      userPrefs_buying_information = $("input#buying_information_emailpref").is(':checked');
      userPrefs_buying_information_phone = $("input#buying_information_phonepref").is(':checked');
  
      userPrefs_special_offer = $("input#special_offer_emailpref").is(':checked');
      userPrefs_special_offer_phone = $("input#special_offer_phonepref").is(':checked');
  
      $("#email-preference__form button[type='button']").removeAttr("disabled"); // enable the Submit button
  });
  
  function postData() {
      var phoneNumber = $('#phonenumber').val();
      if(!phoneNumber &amp;&amp; (userPrefs_special_offer_phone || userPrefs_lease_information_phone || userPrefs_buying_information_phone || userPrefs_newsletters_phone)){
          alert("Please enter the phone number to opt in for text notifications");
      } else{
          console.log("postData:"+ "123");
  
  
      // });
  
      }
  }
  </code></pre>
  
  <pre class="lang-html prettyprint-override"><code>&lt;script src="https://cdn.jsdelivr.net/npm/jquery-validation@1.19.1/dist/jquery.validate.min.js"&gt;&lt;/script&gt;
  &lt;div class="row   section-container-toppadding section-container-bottompadding clearfix columnctrl"&gt;
    &lt;div class="row"&gt;
      &lt;div&gt;
        &lt;div class="col-md-12 col-sm-12 col-xs-12"&gt;
          &lt;div class="row unsubscribe-section mb50"&gt;
            &lt;!-- View 1: Preferences --&gt;
            &lt;div class="col-md-12"&gt;
              &lt;h2 class="pref-heading"&gt;Notification Preference Center&lt;/h2&gt;
            &lt;/div&gt;
            &lt;div&gt;
              &lt;div class="col-md-12 col-sm-12 col-xs-12 preferences"&gt;
                &lt;p class="lead col-md-12 col-lg-7 p0 pt10 pb40 m0"&gt; Get the notifications you want and need. Please choose the options below that best fit your needs.&lt;/p&gt;
                &lt;form id="email-preference__form" novalidate="novalidate" action="/en-us/email-preference-center-thankyou.html" method="get" class="preference-form"&gt;
                  &lt;div class="row preference-form--contactinfo col-lg-8"&gt;
                    &lt;!-- Email Address --&gt;
                    &lt;div class="col-md-5 col-sm-7 col-xs-12 p0 col-lg-6"&gt;
                      &lt;div class="form-group"&gt;
                        &lt;label for="emailaddress"&gt;Email Address&lt;/label&gt;
                        &lt;input data-minlength="3" placeholder="Label" value="" id="emailaddress" name="emailaddress" type="text" required="" class="valid" aria-invalid="false"&gt;&lt;label id="emailaddress-error" class="error" for="emailaddress" style="display: none;"&gt;&lt;/label&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;!-- Phone Number --&gt;
                    &lt;div class="col-md-5 col-sm-7 col-xs-12 p0 col-lg-6"&gt;
                      &lt;div class="form-group"&gt;
                        &lt;label for="phonenumber"&gt;Phone Number&lt;/label&gt;
                        &lt;input data-minlength="10" data-msg-required="Please enter something here!" placeholder="Label" value="" id="phonenumber" name="phonenumber" type="number" class="valid" aria-invalid="false"&gt;&lt;label id="phonenumber-error" class="error"
                          for="phonenumber" style="display: none;"&gt;&lt;/label&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="choices pt20 pb20 mt10"&gt;
                    &lt;div class="row choices-mob__header"&gt;
                      &lt;div class="col-md-12 col-sm-12 col-xs-12 hidden-xs"&gt;
                        &lt;div class="col-sm-8"&gt;&lt;/div&gt;
                        &lt;div class="checkbox-wrapper col-sm-4 p0"&gt;
                          &lt;div class="col-sm-6 pl0"&gt;Email&lt;/div&gt;
                          &lt;div class="col-sm-6 pl0"&gt;Text&lt;/div&gt;
                        &lt;/div&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div class="row choices--contents ml0 mr0 mb20 pb20"&gt;
                      &lt;div class="col-md-12 col-sm-12 col-xs-12 pl0 pr0"&gt;
                        &lt;div class="form-group col-sm-8 p0"&gt;
                          &lt;div class="checkbox-ios-v2"&gt;
                            &lt;div class="checkbox-ios-v2-copy"&gt;
                              &lt;h5&gt;GM Financial Newsletter &amp;amp; Announcements&lt;/h5&gt;
                              &lt;p&gt; Be the first to receive tips on auto finance basics.&lt;/p&gt;
                            &lt;/div&gt;
                          &lt;/div&gt;
                        &lt;/div&gt;
                        &lt;div class="checkbox-wrapper col-sm-4 p0"&gt;
                          &lt;div class="col-sm-6 pl0"&gt;
                            &lt;div class="checkbox"&gt;
                              &lt;input autocomplete="off" type="checkbox" name="newsletters_emailpref"                                    id="newsletters_emailpref" class="valid"&gt;
                              &lt;label class="checkbox-check" tabindex="0"                                                             for="newsletters_emailpref"&gt;Email&lt;/label&gt;
                            &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;div class="col-sm-6 pl0"&gt;
                            &lt;div class="checkbox"&gt;
                              &lt;input autocomplete="off" type="checkbox" name="newsletters_phonepref"                                   id="newsletters_phonepref" class="valid"&gt;
                              &lt;label class="checkbox-check" tabindex="0"                                                             for="newsletters_phonepref"&gt;Text&lt;/label&gt;
                            &lt;/div&gt;
                          &lt;/div&gt;
                        &lt;/div&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;             
                  &lt;/div&gt;
                  &lt;div class="row submit-btn mb60"&gt;
                    &lt;div class="col-sm-4 col-xs-12"&gt;
                      &lt;!-- &lt;button type="submit"&gt;Submit&lt;/button&gt; --&gt;
                      &lt;button type="button" class="btn btn-primary" onclick="postData()"&gt;SAVE&lt;/button&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
  
                &lt;/form&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>