Unbind keypress handler for specific combination only

Posted by Fedyashev Nikita on Stack Overflow See other posts from Stack Overflow or by Fedyashev Nikita
Published on 2010-04-21T04:45:11Z Indexed on 2010/04/21 5:03 UTC
Read the original article Hit count: 387

Filed under:

I have 2 keydown handlers:

$(document).bind('keydown', function(e) {
   if (e.keyCode == 75) {
       // handler1 strategy
   } else if (e.keyCode == 78) {
       // handler2 strategy
   }

});

How can I unbind one handler without affecting all the other keydown handlers?

updated.

© Stack Overflow or respective owner

Related posts about jQuery