检查数字是否在逗号分隔列表中的最简单方法是什么?
console.log(provider[cardType]);
//returns: Object { name="visa", validLength="16,13", prefixRegExp=}
if (ccLength == 0 || (cardType > 0 && ccLength < provider[cardType].validLength)) {
triggerNotification('x', 'Your credit card number isn\'t long enough');
return false;
} else {
if ($('.credit-card input[name="cc_cvv"]').val().length < 3) {
triggerNotification('x', 'You must provide a CCV');
return false;
}
最佳答案
看起来类似于this所以问题。
只需 .split() CSV 并使用 inArray。
关于列表中的 JavaScript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4329331/