I am setting up a function to do the calculation using percentage. In my online test it works.
$(document).ready(function () {
valorTotaldaNota = "1.000,00";
valorTotaldaNota = valorTotaldaNota.replace(",", "");
adValorem = "0.33";
gris = "0.20";
v1 = valorTotaldaNota * adValorem / 100;
v2 = valorTotaldaNota * gris / 100;
alert( v1 + v2 );
});
But in my local file, the calculation is not correct and appears a lot of zero in the freight. Ex: 0.0087
$(document).ready(function () {
$(".seguro").click(function() {
valorTotaldaNota = $("#valorTotaldaNota").val();
valorTotaldaNota = (valorTotaldaNota.replace(",", ""));
adValorem = ($("#adValorem").val());
gris = <?php echo $gris; ?>
v1 = valorTotaldaNota * adValorem / 100;
v2 = valorTotaldaNota * gris / 100;
$("#valordoSeguro").val( v1 + v2 );
});
});