3

I am trying to make a Google Docs add-on that uses custom keyboard shortcuts to activate special features. I can get the letter key codes to work, however, I need to use the [Ctrl] key but the javascript keycode "17" won't work.

Can anyone help me with this? I have looked "everywhere" (A LOT of places) for how to get this to work but I just can't seem to find the right thing.

  • Possible duplicate of [How to create custom keyboard shortcuts for google app script functions?](https://stackoverflow.com/questions/13731589/how-to-create-custom-keyboard-shortcuts-for-google-app-script-functions) – Rubén Oct 23 '17 at 18:42

1 Answers1

0

Try the snippet from this SO post:

$(document).keydown(function(e){ 
  //CTRL + V keydown combo 
  if(e.ctrlKey && e.keyCode == 86){ 
    $( '#output' ).html("I've been pressed!"); 
  } 
}) 
Community
  • 1
  • 1
ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56
  • The full code to implement it can be found [here](https://stackoverflow.com/a/44345522/3154274) – MagTun Jun 04 '17 at 13:07