JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" value="12345" />

CSS

input { line-height:2; font-size:200%; }

JavaScript

(function($){
    // "1234567".commafy() returns "1,234,567"
    String.prototype.commafy = function() {
      return this.replace(/(.)(?=(.{3})+$)/g,"$1,")
    }
    $.fn.digits = function () {
        return this.each(function () {
            $(this).val($(this).val().commafy());
        })
    }
})(jQuery)
    
jQuery(function(){
    $('input[type=text]').digits();
});