JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text">
<br/>
<input type="text" class="textInput">
JavaScript
$(document).ready(function() {
$(document).keydown(function(e) {
var elid = $(document.activeElement).hasClass('textInput');
console.log(e.keyCode + ' && ' + elid);
if (e.keyCode === 8 && !elid) {
return false;
};
});
});