因此,虽然 LiveAddress 非常适合美国地址,但我们也必须支持国际地址。我已经有一个国家下拉菜单,仅当该人选择美国时才启用 LiveAddress。但是,我现在需要在有人选择美国以外的国家/地区时“禁用”LiveAddress。
$(".chosen-select").on("change", function (e) {
if (e.added.id == "USA") {
showUSStates();
$.LiveAddress("<My Key>");
} else if (e.added.id == "CAN") {
showCANProvinces();
//Disable Live Address here?
} else {
//Disable Live Address here?
$("label[for=State]").html("Province");
$("#State").hide()
$("#Province").show()
$("#State").empty();
}
});
谢谢!
解决方案:
所以它没有记录在他们的网页中,但我阅读了未最小化的js 文件,发现如果你映射国家字段,一旦有人选择美国以外的国家,他们的库会自动关闭。
$(document).ready(function () {
showUSStates();
$.LiveAddress({
key: "<My Key>",
addresses: [{
id: 'billing',
street: '#Address1',
city: '#City',
state: '#State',
zipcode: '#PostalCode',
**country: '#Country'** }],
autoVerify: false
});
});
很棒的功能,不幸的是在线文档没有详细说明这个功能,在线聊天团队也不知道这个功能。