javascript - HTC One X KeyCode always returns zero -
i have need validate text entered textbox using javascript before it's sent off third party acted upon.
to this, i'm using browserevent.keycode parameter keycode sent browser on key-up event, validating code whether it's allowed in textbox or not.
this works fine across devices i've tested, apart chrome on htc 1 x.
i've found annoying differences between various android , ios devices, return can work with. htc 1 x, however, returns 0 every key press apart backspace , enter keys, return 8 , 13 respectively.
i've tried event.keycode, event.charcode , event.which browserevent.keycode, browserevent.charcodeand browserevent.which codes, , returned 0.
basically, i'm stuck. have idea
- why
keycodereturned0on device, , - how can detect
keycode?
although doesn't answer immediate question, used of ideas lukas knuth gave me solve it.
the process keycode of 0 caught , handed function runs contents of input box through regex validation. if validation fails, last character removed input box.
i apologise if comes question seeking solution htc 1 x passing through 0 keycode, after couple of days of research , experimentation, couldn't find solution, worked around problem instead.
Comments
Post a Comment