How to expolde value from input type checkbox for auto sum in this code?

Easy way is to split() the checkbox value.

var val = thisInput.value, // "bgh_9.99"
    split_array = val.split("_"), // ["bgh", "9.99"]
    number = split_array[1]; // "9.99"
sum += parseFloat(number); // 9.99

Leave a Comment