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!
精彩评论