JSFiddle - React, Tailwind, and code Playground
by BramVanroy
HTML
<input type="radio" id="show1" name="group">
<label for="show1">Show</label>
<input type="radio" id="hide1" name="group" checked>
<label for="hide1">Hide</label>
JavaScript
$(document).ready(function () {
$(document).keyup(function(e) {
if (e.keyCode == 27 && $('input#show1').is(':checked')) {
alert('Esc key pressed.');
}
});
});