JSFiddle - React, Tailwind, and code Playground

by jfriend00

HTML

Click here to establish focus and then press the Ctrl key
<div id="result"></div>

JavaScript

$(document).keydown(function(e) {
    if (e.which == 17) {
        $("#result").append("ctrl key pressed<br>");
    }
});

$(document).keyup(function(e) {
    if (e.which == 17) {
        $("#result").append("ctrl key released<br>");
    }
});