JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" />
<div class="which"></div>
<div class="char"></div>

JavaScript

$('input').on('keydown', function(e) {
    $('div.which').text(e.which);
    $('div.char').text(String.fromCharCode(e.keyCode));
    $('input').val('');
}).focus();