The explanation is below the code:
The code for HTML is :
Add-ons
I have done complete bins for above query. here is demo link as well.
Demo: http://codebins.com/bin/4ldqp85
HTML
Add-ons
Add-on Number 1 - 10 QR
Add-on Number 2 - 20 QR
Add-on Number 3 - 40 QR
Add-on Number 4 - 60 QR
I want more add-ons
User total usage:
JQuery
$(function() {
$('input[name="ch1"]:checkbox').change(function() {
var total = 0;
$('input[name="ch1"]:checked').each(function() {
total += parseInt($(this).val());
});
total += parseInt($('#more').val());
$('#usertotal').html(total);
});
$('#more').change(function() {
var selectVal = $(this).val().trim();
if (parseInt(selectVal) > 0) {
$("#span").html("more addons: " + selectVal);
} else {
$("#span").html("");
}
$('input[name="ch1"]:checkbox').trigger('change');
});
});
Demo: http://codebins.com/bin/4ldqp85