jquery string to number with decimal code example
Example 1: javascript convert string to float
let stringNumber = "8.0"
let floatNuumber = parseFloat(stringNumber);
Example 2: how to change a string to number in javascript
let theInt = parseInt("5.90123");
let theFloat = parseFloat("5.90123");
Example 3: jquery convert number to decimal
$(document).ready(function() {
$('.add').click(function() {
var value = parseFloat($('#total').text()) + parseFloat($(this).data('amount'))/100
$('#total').text( value.toFixed(2) );
});
})