Is it possible to map key combinations in javascript? For instance, tabs are used to navigate between form element. Now can i map tab to another key (say C-n) and navigate with that key combination?
Is it possible to map key combinations in javascript? For instance, tabs are used
Share
Would take 2 steps:
1) Disable built-in tab navigation. You can do this by adding a tabIndex=”-1″ property to your input elements
2) Hook keyboard events with JavaScript to do your own custom navigation. I would recommend a keybinding library, such as keymaster to help simplify things.
If you don’t want to use a library, you’ll be interested in the keydown/keyup events, attached at the document level (see the MDC entry for Keyboard Events for more information).