How can we convert a JavaScript string variable to decimal?
Is there a function such as:
parseInt(document.getElementById(amtid4).innerHTML)
I made a little helper function to do this and catch all malformed data
function convertToPounds(str) { var n = Number.parseFloat(str); if(!str || isNaN(n) || n < 0) return 0; return n.toFixed(2); }
Demo is here