replace
var noCommas = $('.money').text().replace(/,/g, ''),
asANumber = +noCommas;
Answer from Joe on Stack OverflowJquery
forum.jquery.com › portal › en › community › topic › jquery-strip-out-all-of-the-commas-in-numeric-text-field
[jQuery] Strip out all of the commas in numeric text field
We cannot provide a description for this page right now
Jquery
How to remove comma from number which comes dynamically in .tpl file
i want to remove comma from a number (e.g change 1,125 to 1125 ) in a .tpl file. More on stackoverflow.com
remove comma separation from the specific number from JS
I want to remove comma separation from the specific number but i want decimal places and i wrote a regular expression for that, when i pass a number with decimal places it is ok. var num = '12,312... More on stackoverflow.com
jquery - How to remove commas and decimals from value - Stack Overflow
I have an input field where the user can enter their property value. This value then gets commas and decimals added to it on Keyup. I'm trying to remove those commas and decimals. This is my JS. More on stackoverflow.com
Jquery
forum.jquery.com › topic › jquery-strip-out-all-of-the-commas-in-numeric-text-field
Jquery
July 16, 2010 - We cannot provide a description for this page right now
YouTube
youtube.com › dritalconnect
How to remove comma from number from string in JavaScript - YouTube
How to remove comma from number from string in JavaScript
Published May 30, 2022 Views 910
onlinecode
onlinecode.org › home › how to remove comma from string in jquery with example ?
How to remove comma from string in jquery with example ?
February 23, 2023 - Sometimes, we require to remove comma, semicolon, colon etc from string in your jquery code At that time you can simply remove comma using js replace().
NiceSnippets
nicesnippets.com › blog › how-to-remove-comma-from-string-in-jquery
How To Remove Comma From String In JQuery?
April 19, 2021 - Jquery replace() through we can replace comma into empty string that way comma will be remove from jquery string.
YouTube
youtube.com › knowledge base
jQuery : How to remove comma from number which comes dynamically in .tpl file - YouTube
jQuery : How to remove comma from number which comes dynamically in .tpl file [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] jQuery :...
Published January 23, 2022 Views 5
Laserfiche Answers
answers.laserfiche.com › questions › 66574 › How-to-Remove--From-Number-Fields
How to Remove ',' From Number Fields? - Laserfiche Answers
In Forms 9.2 I have noticed that ... this? We have number fields that are used for zip codes and having a ',' in the zip code is not ideal. ... Since this is IE specific behavior, you can workaround this by using the following javascript to remove commas from the ...
Top answer 1 of 6
13
You can simplify the regular expression:
num.replace(/,/g, '')
2 of 6
2
Replace the regex in the replace method with /,/g which means matches the character,literally (case sensitive)
var num = '12,312,313,214,214,324.89';
var num2 = '12,312,313,214,214,324';
function replaceComma(num) {
return num.replace(/,/g, '');
};
console.log(replaceComma(num));
console.log(replaceComma(num2));
Run code snippetEdit code snippet Hide Results Copy to answer Expand
Stack Overflow
stackoverflow.com › questions › 62816867 › how-to-remove-commas-and-decimals-from-value
jquery - How to remove commas and decimals from value - Stack Overflow
July 9, 2020 - Make use of slice() method on strings and filter() method of arrays to filter out any number of commas(,) in your input.
Top answer 1 of 3
3
You can try using replace. The g in the function will find all instances of "," in the string and replace it with nothing.
var mystring = "1,000,000";
mystring = mystring.replace(/,/g,"")
console.log(mystring);
2 of 3
0
Can't you do something like this then,
Altough the dollar sign is not included:
var num="1,000,00";
var getin=true;
var concatenate="";
for (var i=0; i<num.length; i++)
{
if (num[i]=="," && getin){ getin=false;continue;}
concatenate+=num[i];
}
alert(parseInt(concatenate));
It would also work for values greater then 9999 ect..
Experts Exchange
experts-exchange.com › questions › 26813873 › Removing-Commas-from-an-input-text-field-with-Jquery.html
Solved: Removing Commas from an input text field with Jquery | Experts Exchange
February 11, 2011 - I like the idea of using Jquery as it makes the change on the fly and is visual to the end user. Any thoughts would be greatly appreciated · <!--USED TO REMOVE COMMAS FROM TXT FIELDS http://www.decorplanit.com/plugin/publicFunctions.htm--> <script src="../../Scripts/jquery-1.4.2.js" type="text/javascript"></SCRIPT> <SCRIPT src="../../Scripts/AutoNumberic/jquery.metadata.js" type=text/javascript></SCRIPT> //needed if changing defaults <script src="../../Scripts/AutoNumberic/autoNumeric-1.6.2.js" type="text/javascript"></SCRIPT> <script src="../../Scripts/AutoNumberic/autoLoader.js" type="text/javascript"></SCRIPT> <script type="text/javascript"> //I don't think the code here is legit $(document).ready(function() { $.fn.autoNumeric.Strip(dollarvalue, {options} ); }); </script> //// input txt field ///// <input class="strip" type="text" name="dollarvalue" id="dollarvalue" />
Top answer 1 of 3
17
Try this. Updated your code:
$(".remove").each(function(){
$(this).html($(this).html().replace(/,/g , ''));
});
<html>
<head>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.4.min.js"></script>
</head>
<body>
<span class="remove">,17500000</span>
<span class="remove">,2479000</span>
</body>
</html>
Run code snippetEdit code snippet Hide Results Copy to answer Expand
2 of 3
3
I would iterate over each element and change its' text:
var removebox = $(".remove");
removebox.each(function () {
var oldtext = $(this).text();
$(this).text(oldtext.replace(',', ''));
});
Top answer 1 of 5
5
Please use /[^0-9\.]/g regex to replace comma, use indexOf for find the position of comma AND use parseInt to make that string into integer.
Please follow the below example::
var a = '1,200.00';
var b = '12.33';
var c = '123.34';
var d = '1,434';
var e = '165,33';
var f = '250.00';
var g = '259,00';
$(document).ready(function () {
parseNumberCustom(a);
parseNumberCustom(b);
parseNumberCustom(c);
parseNumberCustom(d);
parseNumberCustom(e);
parseNumberCustom(f);
parseNumberCustom(g);
});
function parseNumberCustom(number_string) {
var new_number = parseInt(number_string.indexOf(',') >= 3 ? number_string.split(',')[0] : number_string.replace(/[^0-9\.]/g, ''));
console.log('Before==>' + number_string + ', After==>' + new_number);
}
2 of 5
2
Check this
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<script>
$(document).ready(function(){
$("#Convert").click(function(){
var currency1 = $("#mode").val()
if (currency1.indexOf(",") >= 0 && currency1.indexOf(".") >= 0)
{
var intvalue =(parseInt(currency1.replace(/[^0-9\.]/g, '')));
alert(intvalue)
}
if (currency1.indexOf(".") >= 0 && currency1.indexOf(",") < 0)
{
var intvalue = Math.floor( currency1 );
alert(intvalue)
}
if (currency1.indexOf(",") >= 0 && currency1.indexOf(".") < 0)
{
var streetaddress= currency1.substr(0, currency1.indexOf(','));
alert(streetaddress)
}
})
});
</script>
<body>
<div class="table-responsive container">
Enter Value:
<input type=Text id="mode" text="Switch Mode" class="Form-control" value="" >
<input type=Button id="Convert" text="Switch Mode" class="btn btn-primary" value="Convert" >
</div>
</body>
</html>
Podio
help.podio.com › hc › en-us › community › posts › 360010353719-Remove-comma-from-Numbers-in-Number-box
Home
February 4, 2021 - Loading · ×Sorry to interrupt · This page has an error. You might just need to refresh it. [Unhandled PromiseRejection (check your browser console to find the code that isn't handling the error 'Uncaught (in promise)'): undefined] · Refresh · Skip to Main Content · Help Center - Home ...