How to not focus input on keyboard key #2 combination

jquery

#1

Hello!

I want to make some action on keyboard key combination, in this case #2
issue is that i have input in page that have and need autofocus. …
So when i hit #2 it types it inside input

Example: http://jsfiddle.net/obf3xsLa/ (click outside input to see that #2 works)

Question is how to tell it if entered combination #2 to leave input and do function?

P.S. I m using Mousetrap.js


#2

Hi @fumeeptc, according to the docs you can add a mousetrap class to the input element so that the combination also works inside it. This will also leave the input.


#3

Oh my i never saw that :slight_smile: Thanks allot!!


closed #4

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.