If you want to change those spans to text inputs, your code should look like this:
var inputs = document.getElementsByClassName('sum'),
total = document.getElementById('payment-total');
total1 = document.getElementById('payment-rebill');
for (var i=0; i < inputs.length; i++) {
inputs[i].onchange = function() {
var add = this.value * (this.checked ? 1 : -1);
total.value = parseFloat(total.value) + add;
total1.value = parseFloat(total1.value) + add;
}
}
solved How to display the result of this checkbox checked function to a text feild [closed]