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) {});
Try this:
jQuery('#myInput').keypress(function(e) { code = e.keyCode ? e.keyCode : e.which; if(code.toString() == 13) { alert('You pressed enter!'); } });