Yes -- parseFloat.

parseFloat(document.getElementById(amtid4).innerHTML);

For formatting numbers, use toFixed:

var num = parseFloat(document.getElementById(amtid4).innerHTML).toFixed(2);

num is now a string with the number formatted with two decimal places.

Answer from lonesomeday on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › parseFloat
parseFloat() - JavaScript | MDN
Note: JavaScript does not have ... values. For example, parseInt("42") and parseFloat("42") would return the same value: a Number 42. The parseFloat function converts its first argument to a string, parses that string as a decimal number literal, then returns a number ...
🌐
Mikemcl
mikemcl.github.io › decimal.js
decimal.js API
An arbitrary-precision Decimal type for JavaScript. Hosted on GitHub. The library is incorporated into this page, so it should be available in the console now. See the README on GitHub for a quick-start introduction. In all examples below, var and semicolons are not shown, and if a commented-out value is in quotes it means toString has been called on the preceding expression.
🌐
CodeSweetly
codesweetly.com › javascript-parseint-method
parseInt() in JavaScript – How to Convert String to Decimal | CodeSweetly
It converts the string argument from its radix state to a decimal integer. Use JavaScript’s parseInt() method to convert strings from their radix state to a decimal integer.
🌐
ServiceNow Community
servicenow.com › community › servicenow-ai-platform-forum › javascript-convert-string-to-number-but-keep-decimal › m-p › 1081110
Javascript: Convert string to number but keep decimal
October 21, 2022 - Not sure if it is supported in Portal (or Workspace), but in Platform UI (UI16/Polaris) GlideForm has a method to return the value as a Number: ... I'm assuming this a Client Script environment. ... As for the problem with the original solution: both parsers stop parsing at the 1st illegal character. Since JavaScript only recognizes the dot as decimal separator and does not use grouping characters, both will stop parsing before the comma grouping separator in your string.
🌐
Educative
educative.io › answers › how-to-convert-string-to-int-or-number-in-javascript
How to convert string to int or number in JavaScript
In JavaScript, the double tilde (~~) operator can be used to convert a string to a number, but this method will truncate any decimal portions if the input string contains a decimal value.
🌐
Scaler
scaler.com › home › topics › convert string to number in javascript
String to Number Javascript | Scaler Topics
January 6, 2024 - ... Then the parseInt will output NaN as the first character of the given string is 'M' which cannot be converted into a number. A string in a Javascript program can be converted into a number using the unary operator (+).
🌐
JavaScripter
javascripter.net › faq › convert2.htm
JavaScript string-to-number conversion
Converting Strings to Numbers JavaScript FAQ | Numbers FAQ | Strings and RegExp FAQ · Question: How do I convert strings to numbers in JavaScript
Find elsewhere
🌐
Flexiple
flexiple.com › javascript › string-to-number
How to Convert a String to a Number In JavaScript - Flexiple
In cases where the string contains a decimal number, parseInt() truncates the decimal part and returns the integer. To convert the string "123.456" to a number, parseInt("123.456") will provide the result 123.
🌐
Go Make Things
gomakethings.com › converting-numbers-to-strings-with-vanilla-javascript
Converting numbers to strings with vanilla JavaScript | Go Make Things
Today, we’re looking at how to convert numbers to strings with JavaScript. Let’s dig in! You can use the Number.toFixed() method to format a number to a fixed number of decimal places.
🌐
freeCodeCamp
freecodecamp.org › news › how-to-convert-a-string-to-a-number-in-javascript
How to Convert a String to a Number in JavaScript
May 2, 2022 - Another way to convert a string into a number is to use a basic math operation. You can multiply the string value by 1 and it will return a number. ... As you can see, when we multiply the quantity value by 1, then it returns the number 12.
🌐
Built In
builtin.com › articles › javascript-string-to-a-number
How to Convert a JavaScript String to Number | Built In
Below are several different methods you can use to convert a string into a number in JavaScript with example code. parseInt() parses a string and returns a whole number. Spaces are allowed. Only the first number is returned. This method has a limitation though. If you parse the decimal number, ...
🌐
SitePoint
sitepoint.com › blog › javascript › quick tip: how to convert a string to a number in javascript
Quick Tip: How to Convert a String to a Number in JavaScript — SitePoint
November 6, 2024 - This short tutorial has covered three ways to convert a string to a number in JavaScript. Number() can convert a string to a number, whether it’s a float or an integer. However, if the string contains other characters, it returns NaN.
🌐
DEV Community
dev.to › himanshudevgupta › 7-ways-to-convert-a-string-to-number-in-javascript-35pd
7 ways to convert a String to Number in JavaScript - DEV Community
February 21, 2023 - One might need to use parseFloat() method for literal conversion. myString = '129' console.log(parseInt(myString)) // expected result: 129 a = 12.22 console.log(parseInt(a)) // expected result: 12 · 2. Using Number() Number() can be used to ...
🌐
W3Schools
w3schools.com › jsref › jsref_tofixed.asp
JavaScript toFixed() Method
❮ Previous JavaScript Number Reference Next ❯ · let num = 5.56789; let n = num.toFixed(); Try it Yourself » · let num = 5.56789; let n = num.toFixed(2); Try it Yourself » · More examples below · The toFixed() method converts a number ...
🌐
Go Make Things
gomakethings.com › converting-strings-to-numbers-with-vanilla-javascript
Converting strings to numbers with vanilla JavaScript | Go Make Things
For our use, it should always be 10. var text = '42px'; var integer = parseInt(text, 10); // returns 42 · The parseFloat() method converts a string into a point number (a number with decimal points).
🌐
W3Schools
w3schools.com › jsref › jsref_parsefloat.asp
JavaScript parseFloat() Method
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-parse-float-with-two-decimal-places-in-javascript
How to Parse Float with Two Decimal Places in JavaScript? - GeeksforGeeks
Example 1: In this example the parseFloat converts strings to floating-point numbers. toFixed(2) rounds the number to 2 decimal places, returning a string.
Published   July 23, 2025
🌐
Medium
medium.com › @a1guy › how-to-convert-strings-to-numbers-in-javascript-9733d6314fec
How to Convert Strings to Numbers in JavaScript | by Ali Aslam | Medium
March 16, 2025 - Let’s explore some techniques available to use in JavaScript. Technique#1: Using Number() prebuilt function of JavaScript · The `Number()` function converts a string into a number. It works well for both integers and decimals.