Commit 3a5f04a8 authored by Mat's avatar Mat

calcule le total

parent 98e3922c
......@@ -63,6 +63,19 @@ gridItems.forEach(function(item)
formItem.querySelector("input[id$=prix]").value = prix;
});
// lorsqu'on relâche la souris
// recalcule le total
let spanTotal = document.querySelector("span#total");
input.addEventListener('mouseup', function()
{
let total = 0;
for (let formItem of formItems) {
total = total + parseFloat(formItem.querySelector("input[id$=prix]").value);
}
spanTotal.textContent = total.toFixed(2);
});
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment