JSFiddle - React, Tailwind, and code Playground

https://stackoverflow.com/questions/38607309/only-want-leftarrow-right-arrow-and-numbers

HTML

<input id='x' type='text'/ >

JavaScript

$('#x').keypress(function(event) {
    var key = event.Which || event.keyCode
    console.log(key);
    if ((key >= 48 && key <= 57) || (key == 37)) {
        return true;
    } else return false;
});