jQuery custom validation: phone number starting with 6

前端 未结 3 879
南笙
南笙 2020-12-17 05:17

I have a form in which you have to input your phone number and other fields.

I\'m validating the form with jQuery Validate.

To validate the phone number fi

3条回答
  •  伪装坚强ぢ
    2020-12-17 05:55

    I think you will need to add a custom validator.

    $.validator.addMethod("phoneNumber", function(uid, element) {
        return (this.optional(element) || uid.match(phone number regex));
    }
    

提交回复
热议问题