仅在条件为假的情况下执行语句时才执行代码。
我尝试了调试,我给出的条件肯定是错误的回复,但不确定为什么
if (
$("#ship-to-different-address-checkbox").length != 0 &&
$(".shipping_address").length == 0
) {
postcode = $("#shipping_postcode").val();
} else {
postcode = $("#billing_postcode").val();
}
我也尝试过
if (
$("#ship-to-different-address-checkbox").length != 0 &&
$(".shipping_address").is(":visible")
) {
postcode = $("#shipping_postcode").val();
} else {
postcode = $("#billing_postcode").val();
}
无论if语句要执行什么操作。有人可以帮我吗?