I am wanting to subtract some values of inputs with the total price.
The code:
$('.calculate-resterend').click(function(e) {
e.preventDefault();
var contant = $('.checkout-contant').val();
var pin = $('.checkout-pin').val();
var creditcard = $('.checkout-creditcard').val();
var waardebon = $('.checkout-waardebon').val();
var totalprice = $('.total.final-price.price').text();
alert(contant - totalprice);
});
But this returns NaN
. I figure it's because total price is .text();
,
but what is the correct way to substract between these things.
Lets say var contant
has a value of 2000,98
and the total price
has a value of 2400,99
I want it to return 400,01
.