With jQuery, how do I find out which key was pressed when I bind to the keypress event?
$(\'#searchbox input\').bind(\'keypress\', function(e) {});
>
The event.keyCode
and event.which
are depracated. See @Gibolt answer above or check documentation: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent
event.key
should be used instead
keypress
event is depracated as well:
https://developer.mozilla.org/en-US/docs/Web/API/Document/keypress_event