Rounding In Javascript To 2 Decimal Places June 28, 2022 Post a Comment I have a dropdown list and it has values which are to 2 decimal places. Delivery: Solution 1: Don't use parseInt() (as it kills the decimals). Use parseFloat() then toFixed(): var delivery = parseFloat($('#delivery').val()).toFixed(2); Copy Note: If you are interested in rounds with toFixed(), reference this question. Solution 2: How about var delivery = parseFloat($('#delivery').val()).toFixed(2); Copy Solution 3: use var delivery = parseFloat($('#delivery').val()).toFixed(2); Copy Share Post a Comment for "Rounding In Javascript To 2 Decimal Places"
Post a Comment for "Rounding In Javascript To 2 Decimal Places"