JSFiddle - React, Tailwind, and code Playground

by James Allardice

HTML

<input id="example">

JavaScript

function handler(e) {
    if (e.keyCode === 8) {
        alert("Backspace!");
    }
}

$("#example").on("keydown", function (e) {
    this.keydownFired = true;
    handler.call(this, e);
});