JSFiddle - React, Tailwind, and code Playground

by Sergey khorev

HTML

<input class="price" id="price">

JavaScript

var = price.toString().replace(/(\d)(?=(\d{3})+$)/g, '$1 ');