我正在使用this来验证客户端表单。在一个字段中,我需要接受两个或多个国家的手机号码,这应该是一个有效的手机号码。如果我需要接受印度手机号码或美国手机号码。如何在一个字段中验证这两个字段?
谢谢。
发布于 2011-03-23 04:53:20
您可能希望使用depends字段。
$("#element").validate({
rules: {
phone: {
depends: function(element) {
if('behavestoA' || 'behavestoB'){ return true }else{ return false }
}
}
}
messages: {
phone: "Please format your phone number correctly"
}
})当然,在behavestoA或behavestoB中,你必须把你的条件。
祝好运!
https://stackoverflow.com/questions/5397480
复制相似问题