我想对手机号码进行限制,我必须形成包含手机号码,我想设置其中一个与var mobileInput中的约束相匹配的输入并对其进行一些验证,但我无法进行||为什么?我怎么能做到这一点?
var mobileInput = input.attr('id') === "mobile-number" || input.attr('id') === "student_mobile";
if (mobileInput) {
return validateMobileInput(input, formGroup);
function validateEmailInput(input, formGroup) {
var emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/i;
var validEmail = emailRegex.test(input.val());
if (validEmail) {
successInput(formGroup);
} else {
errorInput(formGroup, "Email is incorrect");
}
return validEmail;
}