Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js remove dollar sign from string

A common problem with HTML input forms is that users tend to include dollars signs when inputting currency numbers.
These dollars signs can be easily removed through JavaScript by using the JavaScript replace function and a simple regular expression.
This is demonstrated in the following example:

var Amount = '$13.22';
var ReplacedAmount = Amount.replace(/$/g,'');
document.write(ReplacedAmount);
 
PREVIOUS NEXT
Tagged: #js #remove #dollar #sign #string
ADD COMMENT
Topic
Name
4+8 =