I have two input fields where I type values. I put a mask so that when I enter the value it will be in 0.00 format. How do I make a simple calculation with 0.00? Because I have a formula that I have passed and that the result, or the 0 or appears NaN. Follow the formula code of the calculation.
$(function(){
$("#precoVendaNoMercado, #descPromo , #descFinan ").change (function(){
if($("#precoVendaNoMercado").val() != "" && $("#descPromo").val() != "" && $("#descFinan").val() != "") {
precoDeVendaRealizado = parseFloat($("#precoVendaNoMercado").val() * (1- (parseFloat($("#precoVendaNoMercado").val())) + parseFloat($("#precoVendaNoMercado").val())) / 100 );
console.log('Calculo:'+precoDeVendaRealizado);
}
});
});
I did what you suggested @Diego Souza. And in the chrome console points to the line:
var desFinan = descFinan.replace('.', '').replace(',', '.'); precoDeVendaRealizado = precoVeNoMerc * (1 - (desPromo + desFinan) / 100 );
Saying "Uncaught TypeError: Can not read property 'replace' of undefined"