JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="edt_text">
<input type="text" id="edt_console" style="width:100%;">
JavaScript
$(document).ready(function() {
$("#edt_text").keydown(function (e) {
$("#edt_console").val(e.keyCode);
// Ensure that it is a number and stop the keypress
if ((((e.keyCode < 48 || e.keyCode > 105)) || !(e.keyCode > 57 && e.keyCode < 96))) {
if(e.shiftKey) return;
e.preventDefault();
}
});
});