JSFiddle - React, Tailwind, and code Playground

by joplomacedo

JavaScript

function isNumberKey(evt) {
  var charCode = (evt.which) ? evt.which : evt.keyCode;
  
  if (charCode != 46 && charCode > 31 
      && (charCode < 48 || charCode > 57))
    return false;

  return true;
}