JSFiddle - React, Tailwind, and code Playground

by shubh0602

HTML

<input name="number" onkeypress="return isInteger(event)" />

JavaScript

var reInteger = /^\d+$/;

function isInteger(value) {
    if (reInteger.test(value)) {
        return true;
    } else {
        return false
    }
}