With jQuery, how do I find out which key was pressed when I bind to the keypress event?
$(\'#searchbox input\').bind(\'keypress\', function(e) {}); >
$(\'#searchbox input\').bind(\'keypress\', function(e) {});
... this example prevents form submission (regularly the basic intention when capturing keystroke #13):
$('input#search').keypress(function(e) { if (e.which == '13') { e.preventDefault(); doSomethingWith(this.value); } });