我正在使用 simpleCart js。我希望在客户选择英国或世界其他地区之前隐藏结帐按钮和运费。这是选择块:
<select id="shippingSelect" onchange="simpleCart.update();">
<option value="nothing" selected="selected">Choose Shipping Location</option>
<option value="uk">UK</option>
<option value="world">Rest of World</option>
</select>
下面是运费和结帐按钮:
<div class="place_order" style="display:none">
<span id="simpleCart_shipping" class="simpleCart_shipping"></span>
<a href="javascript:;" class="simpleCart_checkout btnDownload">checkout</a>
</div>
生成购物车的 simpleCart 脚本:
<script>
simpleCart({
cartColumns: [
{ attr: "name" , label: "Item" },
{ view: "decrement" , label: false , text: "-" },
{ attr: "quantity", label: "Quantity", view: "input"},
{ view: "increment" , label: false , text: "+" },
{ attr: "price", label: "Price"},
{ attr: "total" , label: "Subtotal", view: "currency" }
],
cartStyle: "table",
currency: "GBP",
language: "english-us",
checkout: {
type: "PayPal" ,
email: "email@ddress",
success: "success.html"
},
shippingCustom: function(){
if( $("#shippingSelect").val() == "uk" ){
return 0;
} else {
return 2;
}
}
});
</script>
我以为我可以$('.place_order').css('display', 'inline');
用来更改内联样式,但我不知道该怎么做,是将其合并到 simpleCart 脚本中还是让它触发单独的脚本?也许有更有效的方法?谢谢!