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
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.
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().
YouTube
youtube.com › hey delphi
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 fileTo Access My Live Chat Page, On Google, Search for "hows tech developer connect"...
Published April 20, 2023 Views 0
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 ...
Blogger
using-jquery-insert-comma.blogspot.com
Insert and Remove a comma in a number using Jquery
Using jquery exploding -$ from -$140.00 and making it as 140.00 plus $ 2,653.00 removing comma from here and making it as 2653.00 after subrating 2653.00-140= 2513.00 after that inserting comma 2,453 To do this <script language="JavaScript" type="text/javascript"> var rs_discount=jQuery('.promoappright').find(".cost").text().replace(',',''); if(rs_discount!=''){ rs_discount = rs_discount.split('-$'); var rs_subtotal=jQuery('.totals').find("td:eq(1)").text().replace(',',''); rs_subtotal=rs_subtotal.split('$'); var rs_result=rs_subtotal[1]-rs_discount[1]; var rs_final=rs_result.toFixed(2); if(rs
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(',', ''));
});
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 ...