fromcharcode   4

How to trigger a click on a link using jQuery - Stack Overflow
The answer by Graham Hotchkiss at Jan 24 at 13:41 solved it for me in chrome and safari. I needed to add more code so that it worked in firefox and opera. solution: $(document).keydown(function(event) { // works for chrome and safari var charCode = (event.which) ? event.which : event.keyCode; if(charCode == 37) $('.prev a')[0].click(); // left arrow to go to previous item if(charCode == 54) $('.up a')[0].click(); // 6 or ^ (aka Shift+6) to go up if(charCode == 39) $('.next a')[0].click(); // right arrow to go to next item }); $(document).keypress(function(event) { // works for firefox and opera var charCode = (event.which) ? event.which : event.keyCode; if(charCode == 104) $('.prev a')[0].click(); // h to go to previous item if(charCode == 107) $('.up a')[0].click(); // k to go up if(charCode == 108) $('.next a')[0].click(); // l next item });
webdev  jquery  keyboard  shortcuts  keydown  keypress  fromcharcode  keycode 
december 2014 by frankfarm

related tags

characters  code  javascript  jquery  keyboard  keycode  keydown  keypress  programming  resources  shortcuts  tools  webdev 

Copy this bookmark:



description:


tags: