JSFiddle - React, Tailwind, and code Playground

HTML

<div id="errmsg"></div>

<input type="text" id="number" maxlength="1"/>

JavaScript

$(document).ready(function() {
    $("#number").keydown(function(event) {
        console.log(event.keyCode);
        if ( $.inArray(event.keyCode,[49,50,51,52,53]) !== -1) 
        {
                 alert("allow");
        }
        else {
            alert("not allow");      
        }
    });
  });