114
rated 0 times
[
115]
[
1]
/ answers: 1 / hits: 5815
/ 11 Years ago, tue, december 10, 2013, 12:00:00
I made a JQuery function to calculate the amount including the tax. When I want to set a amount with cents I need to use a dot. It will be like 125.25 euro's. I would like to know how to calculate the amount including tax by using a comma.
here is my code:
if($(#tax).val() == verlegd) { var tax= 0; }
else
{
var tax= parseInt($(#tax).val());
}
var taxCalc = parseInt(100+tax);
var amount= parseFloat($(#amount).val());
var amountinc = Math.round(((amount* taxCalc) / 100)*100)/100;
if(!isNaN(amount))
{
$(#amountinc).val(amountinc);
}
else
{
$(#amountinc).val(unvalid number);
}
}
$(#amount).keyup(function(){ updateTotalExc(); });
$(#tax).change( function(){ updateTotalExc(); });
More From » jquery