<span class="ad-save label label-success">Save $<span class="ad-discount"></span> every time</span>
<div class="col-xs-3 text-right">
- <span class="as-low">As low as:<br /></span>
- <span class="ad-price h1"></span>
+ <span class="as-low" style="display:none;">As low as:<br /></span>
+ <span class="ad-price h1" id="sub-box-price" style="display:none;"></span>
<p class="ad-select-sect">
// Set the prices in the box
var adPriceEl = document.querySelector(".ad-price");
- adPriceEl.innerHTML = '$'+adPrice;
+ adPriceEl.innerHTML = '$'+adPrice.toFixed(2);
// Set the discounts in the select dropdown
adDiscount[i].innerHTML = maxDiscount;
+ // Updates the price in the subscription box
+ document.addEventListener("DOMContentLoaded", function(event) {
+ $('#productextra0').on('change', function(){
+ var dataEl = document.getElementById('keesubscriptions-data');
+ var adSelect = document.querySelector('.ad-select');
+ var price = parseFloat(dataEl.getAttribute('data-productprice'));
+ if($('#productextra0').val() != 0) {
+ var discount = parseInt(adSelect.options[adSelect.selectedIndex].getAttribute('data-price').replace('-', ''));
+ var dPrice = price - discount;
+ // Set the prices in the box
+ var adPriceEl = document.querySelector(".ad-price");
+ adPriceEl.innerHTML = '$'+dPrice.toFixed(2);
+ $('#sub-box-price').show(500);
+ $('.as-low').show(500);
+ $('#sub-box-price').hide();
// Update the discount with the currently selected option