jQuery's 'keypress' doesn't work for some keys in Chrome. How to work around?
use keydown.keypress doesn't work with ESC in Chrome (not sure about other browsers).
$(newTag).keydown(function(e) { //keypress did not work with ESC; if (event.which == '13') { ProfilePage.saveNewTag(search_id, $(newTag).val()); } else if (window.event.which){ $(newTag).remove(); }});
For ESC key:
$(document).keydown(function(e) { if(e.keyCode == 27) { /* Run code */ }}
For letter keys, like 'L':
$(document).keypress(function(e) { if(e.which == 108) { }});
Works in both Chrome and Firefox