I'd like to calculate price excluding tax in real time like this :
Price included taxe (priceTi) = 550
TaxRate = 10 %
Price excluding tax (priceTe) should be = 500
The problem is that I get priceTe = 499.99999999999994
$(document).on('keyup', "#priceTi", function () {
var priceTe = $('#priceTe');
var taxRate = $('#taxRate');
var priceTi = $('#priceTi');
if (taxRate.val() != "") {
value = this.value.replace(/,/g, '.');
var tax = parseFloat((taxRate.val()/100) + 1) ;
$('#priceTe').val(parseFloat(value) / tax ) ;
return false;
}
});