I am trying to add two decimal values but the returned sum is pure integer. What is wrong? I can’t find it. any help will be welcome.
jQuery(".delivery-method #ship_select").change(function(){
var cost = jQuery(this).val();
jQuery("#delivery_cost").val(cost); //returns 20.00
var tot = parseInt(cost) + parseInt(total); //total returns 71.96
});
With the code i am getting only 91 and not 91.96
Use
parseFloat()instead ofparseInt().