Js-hotkeys - how to link with? question mark

I used js-hotkeys for a while, love it.

Now I would like to be attached to a key ? but this does not seem to be supported. Does anyone know why and how to associate with a question mark ? ?

$(document).bind('keydown', '?',function (evt) { alert('go'); }); 

The code above does not work.

+6
jquery jquery-plugins binding hotkeys jquery-hotkeys
source share
4 answers

What about

 $(document).bind('keyup', function (evt) { if (evt.keyCode == 191) alert("go"); }); 
+5
source share

I suppose the event has a flag for pressing the shift key, so you probably want to do something like this (I never used js-hotkeys, so I may be completely wrong):

 $(document).bind('keydown', '/', function (evt) { if (evt.shiftKey) //or whatever the flag for the shift key may be { alert('go'); } }); 
+3
source share

Beware that the following appears in the input window:

 $(document).bind('keyup', function (evt) { if (evt.keyCode == 191) alert("go"); }); 

Decision:

 $(document).bind('keyup', function(e) { if(e.keyCode === 191 && !$(e.target).is("input")) alert("go"); }); 

Keep in mind that the same thing will happen for texarea .

+2
source share

Using js-hotkeys, you must anchor the question mark with a string:

 shift+/ 
0
source share

All Articles