Search
 
SCRIPT & CODE EXAMPLE
 

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);
Comment

PREVIOUS NEXT
Code Example
Javascript :: laravel ajax post request 
Javascript :: generate random password javascript 
Javascript :: jquery check if field exist by name 
Javascript :: how to convert whole strig in lowercase in js 
Javascript :: node js fetch 
Javascript :: How to find the max id in an array of objects in JavaScript 
Javascript :: run react app in different port 
Javascript :: replace class jquery 
Javascript :: document.ready 
Javascript :: npm ERR! code EACCES 
Javascript :: show 5 entries in datatable 
Javascript :: hello world jquery 
Javascript :: jquery input text value change event 
Javascript :: how to check if jquery is loaded 
Javascript :: javascript detect mobile browser 
Javascript :: javascript how to create an array from 1 to 100 
Javascript :: get current page name in javascript 
Javascript :: js get timezone name 
Javascript :: kb to mb javascript 
Javascript :: react chartjs size 
Javascript :: js proxy to array 
Javascript :: how to get file name in directory node js 
Javascript :: angular create project in current directory 
Javascript :: click element via javascript chrome inspector console 
Javascript :: react eslint error missing in props validation 
Javascript :: javascript get origin url 
Javascript :: get iso date javascript 
Javascript :: jquery show flex 
Javascript :: javascript add day to date 
Javascript :: find base url in javascript 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =