JSFiddle - React, Tailwind, and code Playground
by KelseyW
HTML
Key Down: <input type="text" id="keyDown" />
Key Pressed: <input type="text" id="keyPress" />
Key Up: <input type="text" id="keyUp" />
JavaScript
$(function () {
var $kp = $('#keyPress');
var $kd = $('#keyDown');
var $ku = $('#keyUp');
var counter = 1;
$(document).on ('keypress', function (e) {
$kp.val(e.which);
}).on('keydown', function (e) {
$kd.val(e.which);
}).on('keyup', function (e) {
$ku.val(e.which);
});
});