JSFiddle - React, Tailwind, and code Playground

by marsone

HTML

<input type="text" onkeypress="return myKeyPress(event)" />

JavaScript

function myKeyPress(e){

            var keynum;

            if(window.event){ // IE                 
                keynum = e.keyCode;
            }else
                if(e.which){ // Netscape/Firefox/Opera                  
                    keynum = e.which;
                 }
            console.log(String.fromCharCode(keynum));
        }