Reputation: 123
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.
Upvotes: 0
Views: 264
Reputation: 3951
jQuery:
$(document).bind('keydown', function(e) {
if (e.which == 39) {
rightArrowFunction();
}
});
Upvotes: 2