我正在尝试使按钮在选择特定选项时发生变化。或者,如果有人能告诉我如何更改一些文本和价格以最小化代码,那就太好了!
Bundles
<br>
<select id="select-quantity">
<option value="NONE">None</option>
<option value="SIX">Quanitiy 6 ($5.00)</option>
<option value="TWELVE">Quanitiy 12 ($10.00)</option>
<option value="TWNFOUR">Quanitiy 24 ($20.00)</option>
$('#select-quantity').change(function() {
var s = $('.snipcart-add-item[data-item-id="' + $(this).val() + '"]');
});
</select>
<br>
<br>
<button class="snipcart-add-item" id="my-button"
style="border: 0; background: transparent"
data-item-id="NONE"
data-item-url="/"
data-item-name="1 Yin Yang Sticker"
data-item-price="2.00"
data-item-quantity="1">
<img src="http://i.imgur.com/EZ6gneV.png" alt="Add To Cart">
</button>
<button class="snipcart-add-item" style="display: none"
data-item-id="SIX"
data-item-url="/"
data-item-name="6 Yin Yang Stickers"
data-item-price="5.00">
<img src="http://i.imgur.com/EZ6gneV.png" alt="Add To Cart">
</button>
<button class="snipcart-add-item" style="display: none"
data-item-id="TWELVE"
data-item-url="/"
data-item-name="12 Yin Yang Stickers"
data-item-price="10.00">
<img src="http://i.imgur.com/EZ6gneV.png" alt="Add To Cart">
</button>
<button class="snipcart-add-item" style="display: none"
data-item-id="TWNFOUR"
data-item-url="/"
data-item-name="24 Yin Yang Stickers"
data-item-price="20.00">
<img src="http://i.imgur.com/EZ6gneV.png" alt="Add To Cart">
</button>