Set keyboard passkey using keyboard numeric keys with jQuery

I am developing a web application with HTML5 and jQuery 1.10. I am using the accesskey attribute on inputs and links to improve navigation.

Actually I have this code:

    $("#linktabCost").attr("accesskey", "1");
    $("#linktabCapture").attr("accesskey", "2");
    $("#linktabInvoice").attr("accesskey", "3");

      

With this code, the access keys work as follows:

enter image description here

My question is:

How can I set the passkey on the numeric keypad numbers of the keyboard using jQuery?

+4


source to share


1 answer


I managed to solve this problem using shortcut.js library and add keyboard numeric keys (97,98,99 ...) to the library special_keys array.

var special_keys = {
                'numpad_1': 97,
                'numpad_2': 98,
                'numpad_3': 99,
                'numpad_4': 100,
                'numpad_5': 101,
                'esc':27,
                'escape':27,
                'tab':9,
                'space':32,
                'return':13,
                'enter':13,
                'backspace':8
                 ...
}

      



I used this one to solve the problem

+2


source







All Articles