Javascript Code:
$(document).on('click', '#google_analytics', function() {
if ($("#google_analytics").prop('checked') == true) {
var google_analytics_cost = $('#google_analytics_cost').val();
$('.total-amount12').text(google_analytics_cost);
} else {
$('.total-amount12').text('0');
}
});
$(document).on('click', '#mailing_list', function() {
if ($("#mailing_list").prop('checked') == true) {
var mailing_cost = $('#mailing_list_cost').val();
$('.total-amount13').text(mailing_cost);
} else {
$('.total-amount13').text('0');
}
});
I just want to add both total actions to one div. What is called total-amt <div class="total-amt">0</div> In this div, every time I click on an action, the total value should show the div total-amt , and then if I click on another action, then its total amount is too added with the previous amount.
source
share