Binding keys with javascript while preventing browser keyboard shortcuts

I am making a javascript game and have to bind many keys with different functions. This I know how to do it, I need some help, this is toggling keyboard shortcuts for the browser. in other words, I want to blur the hotkeys for the browser and redirect them to my application.

+2


a source to share


1 answer


I believe that if you stop propagating this event, you will not be able to catch it.

an example of this:



element.onkeyup = function(e) {
   var ev = e || event;
   //do stuff here, probably with ev.keyCode

   return false;
}

      

+1


a source







All Articles