How To Capture The Escape Key Using jQuery

1 2 3 4 5 6 7 8 9 |
jQuery(document).keydown(function(e) { if (e.keyCode == 27) { alert('ESCAPE Pressed'); } // esc if (e.keyCode == 13) { alert('ENTER Pressed'); } // enter if (e.keyCode == 9) { alert('TAB Pressed'); } // tab var tagName = jQuery(this).find(':focus').get(0).tagName; //if (tagName == 'INPUT') return false; }); |