0

I need to call a function when a certain letter is pressed, i.e. pressing 'l' changes a div's class, and pressing 'g' changes it to another class.

Can this be done natively in jquery, or will I have to find a plugin?

Thanks.

Richard James
  • 123
  • 2
  • 2
  • 12

1 Answers1

2

jQuery:

$(document).bind('keydown', function(e) {
   if (e.which == 39) { 
       rightArrowFunction();
   }
});
orolo
  • 3,951
  • 2
  • 30
  • 30