Asking this question a second time but providing much more detail this time around, providing a live example and asking a new question as well. The answers to my first question were irrelevant to my needs due to poor communication, and I still need help.
I am creating a pricing interface that will ultimately yield in a user selecting two products (from a selection of 6 - mix & match), which will create two individual prices (one experience price and one collection price in this case). I will need to then combine these prices in order to display a total price. The experience and collection prices are being displayed depending on the selections the user makes just fine.
But now I can't figure out how to add the html values of the two html elements that the user selects. The class total-cost is where this added value should display. I've tried quite a few things in hopes of figuring it out myself, but no luck.
//FOR SELECTING EXPERIENCE AND COLLECTION PACKAGES
$('.pricing-experience, .pricing-collection').on('click', '.flex_column', function() {
var experienceCost = $(this).find('.cost1').html(),
collectionCost = $(this).find('.cost2').html();
$(this).addClass('elephant').siblings().removeClass('elephant');
// console.log(experienceCost);
// console.log(collectionCost);
$('.experience-cost').html(experienceCost);
$('.collection-cost').html(collectionCost);
$('.total-cost').html(experienceCost + collectionCost);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="pricing-experience">
<div class="flex_column">
<span class="cost1">3000</span>
</div>
<div class="flex_column">
<span class="cost1">4000</span>
</div>
<div class="flex_column">
<span class="cost1">5000</span>
</div>
</div>
<div class="pricing-collection">
<div class="flex_column">
<span class="cost2">300</span>
</div>
<div class="flex_column">
<span class="cost2">450</span>
</div>
<div class="flex_column">
<span class="cost2">700</span>
</div>
</div>
<div class="experience-cost">
//cost1's value
</div>
<div class="collection-cost">
//cost2's value
</div>
<div class="total-cost">
//cost1 and cost2's added value
</div>
experienceCostis undefined which is whytotalCostis never being calculated. Where do you setcost1andcost2?