CryNet,
document.addEventListener('DOMContentLoaded', function() {
var menu = document.getElementsByClassName('menu');
for (var i = 0; i < menu.length; i++) {
menu[i].addEventListener('change', getResult)
}
function getResult(){
var cost = 0;
var kkal = 0;
for (let index = 0; index < menu.length; index++) {
if(menu[index].checked) {
cost += parseFloat(menu[index].getAttribute('data-cost'));
kkal += parseFloat(menu[index].getAttribute('data-kkal'));
}
}
document.getElementById('cost').innerHTML = cost;
document.getElementById('kkal').innerHTML = kkal;
}
});