1
I have a value comparison to check if a withdrawal is possible or not.
I’m having trouble formatting the values and making this comparison.
Behold:
And on the console this bringing me formatted this way:
That is, whenever it is valid if the amount to withdraw is less than the available balance, it enters the condition that returns that the value for the serve is greater than the available value, because of the formatting/score.
Follows code:
if (parseFloat($("#txtVlrSacar").val().replace(",", ".")) > parseFloat($("#lblSaldo").text().replace(",", "."))) {
LimparSaque();
swal("", "Valor para saque maior do que valor disponível!", "warning");
return;
}
parseFloat($("#lblSaldo").text()
would not beparseFloat($("#lblSaldo").val()
– adventistaam
for some reason keeps returning with Nan if I change to val()
– Igor Carreiro
Try replacing the dot with blank and comma with dot
$("#lblSaldo").text().replace('.","").replace(",", ".")
– adventistaam