JSFiddle - React, Tailwind, and code Playground

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/dot-luv/jquery-ui.css">
<input type="text" id="myTextBox" />

JavaScript

$("#myTextBox").bind("keypress", function(event) { 
        var charCode = event.which;


        var keyChar = String.fromCharCode(charCode); 
        return /[a-zA-Z0-9]/.test(keyChar); 
    });