JSFiddle - React, Tailwind, and code Playground

by gokulmaha

HTML

<input id="inputField" onkeyup="run(this)" />

function run(field) {
    setTimeout(function() {
        var regex = /\d*\.?\d?/g;
        field.value = regex.exec(field.value);
    }, 0);
}