How to Add Commas to Dynamic Numbers

Home Elementor How to Add Commas to Dynamic Numbers

August 15, 2022

In this Elementor tutorial I will show you how to add commas automatically to larger numbers. This is really helpful if you are displaying large dynamic data and need to display it correctly on the front end.



  • 0:00 Introduction
  • 0:50 Elementor Tutorial Begins

JavaScript Code:

   function numberWithCommas(number) {
    var parts = number.toString().split(".");
    parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
    return parts.join(".");
  $(document).ready(function() {
  $("#wicky h2,#wickydesign h2").each(function() {
    var num = $(this).text();
    var commaNum = numberWithCommas(num);

*Some of the links on this page are affiliate links, meaning we may receive a commission if you follow them. This allows us to continue providing free content and educational resources for you. Thank you for supporting our small business!

More Free Resources

Join Our Community

Wicky Design YouTube

Get our latest videos by subscribing for FREE to our YouTube channel. New videos are uploaded weekly!

Join Our Community

Join now to receive helpful resources, tips, and tutorials in your inbox.