In this code I have, when value reaches 200.00 ... it shows 200, when it has decimal places, it shows the decimal places ... 200.55 = 200.55
However, I need it to show the two decimal places even if it is "10.00", "00" after the dot ...
Another thing is that I need to appear "," from time to time in the print of the site
I thought of putting it, but I do not know where it would go ...
total = parseFloat(total.toFixed(2));
jQuery(document).ready(function() {
jQuery('select[name="service[]"]').change(function() {
let selects = jQuery("select[name=\"service[]\"]");
let total = 0;
/* Percorre todos os select */
$(selects).map(function(i, e) {
let values = $(e).find(":selected");
/* Percorre todos os valores selecionados */
$(values).map(function(k, j) {
total += parseFloat( $(j).data('price').replace(",", ".") );
});
});
$("#preview_value").text(total);
});
});