JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://code.jquery.com/ui/jquery-ui-git.css">
<script src="http://code.jquery.com/ui/jquery-ui-git.js"></script>
<div class="spinnercontent">
<input type="text" class="spinner" value="0">
</div>
JavaScript
$(".spinner").spinner({
min: 0,
step: 250000,
change: function (event, ui) {
var val = event.target.value;
var newVal = "";
for (var i = val.length - 1, counter = 0; i >= 0; i--) {
if (counter == 3) {
counter = 0;
newVal = "," + newVal;
}
counter++;
newVal = val[i] + newVal;
}
event.target.value = newVal;
}
}).on("focus", function () {
$(this).val($(this).val().replace(/,/g, ""));
});