开发者

How to validate two or more mobile numbers in one field, when using jquery validation plugin?

I am using this to validate client forms. In one field i need to accept two or more country mobile 开发者_运维问答number which should be a valid mobile number. Say if i need to accept Indian mobile number or US mobile number. How shall i validate both in one field?

Thanks.


You probably want to use the depends field.

$("#element").validate({
   rules: {
       phone: {
         depends: function(element) {
           if('behavestoA' || 'behavestoB'){ return true }else{ return false }
         }
       }
   }
   messages: {
       phone: "Please format your phone number correctly"
   }
})

in behavestoA or behavestoB you of course then have to put your conditions.

Good luck!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜