JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" id="formattedNumberField" value="" />

JavaScript

//jQuery
$("#formattedNumberField").on('keyup', function(){
    var n = parseInt($(this).val().replace(/\D/g,''),10);
    $(this).val(n.toLocaleString());
});