I am using Mousetrap for create keyboard shortcuts, it was not working when any fields in focus. This is the link for view demo http://davidwalsh.name/keyboard-shortcuts from where i get the code. when i use to call
Mousetrap.bind('ctrl+m', function () {
var button = $('[data-action="next-page"]');
if (button.length) {
button[0].click()
}
});
like this it not working , when mouse points in text-box or drop-down etc,. Can any give solution for me. Thanks in advance.
By default mousetrap disable the shortcuts when the focus is on input fields, dropdown, etc.. If your problem is with only one field, include the class
mousetrap
in it. If you want to disable all scenarios try the following codeThis will overwrite the initial behavior and allow shortcuts in any field of the screen.