Skip to content

Instantly share code, notes, and snippets.

@khanof89
Created April 13, 2018 18:28
Show Gist options
  • Save khanof89/56bd0239dedb512f4462adac8d2e44e6 to your computer and use it in GitHub Desktop.
Save khanof89/56bd0239dedb512f4462adac8d2e44e6 to your computer and use it in GitHub Desktop.
$('.quantity-plus').click(function () {
var total = parseFloat($('.total').html()).toFixed(2);
console.log('total ' + total);
var info = $(this).data('info');
var id = info.item_id;
var price = info.price;
var quantity = $('#quantity-' + id).val();
quantity = parseInt(quantity) + 1;
total += price;
var currentTotal = parseFloat(quantity * price).toFixed(2);
console.log(currentTotal);
$('#amount-' + id).html(currentTotal);
$('.total').html(total);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment