Get key in my webapp dos not work


#1

Hello,
I need to get a key in my web app. When I use the code in Safari I get the keyboard input without using a textbox for example. When I use the same code in a webapp, I didn’t get the keyboard event. How can I change this.

JavaScript
 document.addEventListener('keydown', function(event) {
    if (event.keyCode == 69) {
        zaehlen1();
    }
    if (event.keyCode == 86) {
        zaehlen2();
    }
 }, true);
End JavaScript

regards

Udo


#2

Are you running on a device without a keyboard? In that case, ‘keydown’ does not happen.

Try using ‘touchstart’.


#3

No, I use a bluetooth keyboard.


#4

Did you try touchstart? I have no idea whether a BT keyboard connected to a touch screen device will actually create a keydown event.


#5

Touchstart does not work with keyboard events. A BT Keyboard works fine, but only in browser mode.