如何确保对象键中的选择器匹配的所有元素都具有非空值?主要只是试图避免 if 语句中出现太多参数。
我试过:
var credit_map = {
"#first": "First Name",
"#middle": "Middle Name",
"#last": "Last Name",
"#email": "Email Address",
"#postalcode": "Zip/Postal Code",
"#card_name": "Name on Card",
"#card_number": "Card Number",
"#card_month": "Card Experation Month",
"#card_year": "Card Experation Year",
"#card_verification": "Card Verification Code"
}
for (var [key, value] of Object.entries(credit_map)) {
if ($(key).val() != null || undefined) {
}
}
互换的青春
相关分类