I am working on a project at work where I want to format values on a table from (128879) to look like this (128,879). The code I have used so far is:
$(document).ready(function(){
$('#tableOne tr td:nth-child(3)').each(function(){
var num = $(this).text;
num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,")
}); });
Also, I tried the jQuery NumberFormatter
Library, but an error code shows that jQuery is not defined (the last line of code on the debugger page using Chrome) and Math.js (no luck). Not sure why this is happening.
The <script>
tag used for the jQuery and Math.js is shown below:
<script type = 'text/javascript' src ="jquery.numberformatter-1.2.4.min.js"></script>
<script type="text/javascript" src="math.js"></script>