looking for some help here. I have to create a price check calculator. Two things need to be done:
- If checkboxes with different values are checked the overallprice has to be shown somewhere.
- I need a summary of all selected items. So i need to put the selected items beneath the overallprice.
I managed to get point 1 to work. But im struggling with point 2. I have no clue how to put the checked items elsewhere.
Heres how far ive got:
$(document).ready(function() {
$('input[type="checkbox"]').click(function() {
var total = 0;
//var item = [];
var $parent = $(this).closest('ul');
$parent.find('input:checked').each(function() {
total += parseInt($(this).val());
//item.text();
});
$parent.find('span[class^=total]').html(total + ' €');
var overallPrice = 0;
$('span[class^=total]').each(function() {
overallPrice += parseInt($(this).html().replace(' €',''));
});
$('.overallprice').html(overallPrice)
//$('.overallprice').append(item);
});
});
And for better understanding the JSFIDDLE
I'd be grateful for some help. Thanks alot!