Skip to content

Instantly share code, notes, and snippets.

@bsudekum
Created February 27, 2013 16:05
Show Gist options
  • Save bsudekum/5049036 to your computer and use it in GitHub Desktop.
Save bsudekum/5049036 to your computer and use it in GitHub Desktop.
Adds comma into numbers
$.fn.digits = function(){
return this.each(function(){
$(this).text( $(this).text().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,") );
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment