Questions tagged [keycode]

A number linked with specific key on keyboard in many languages. May be different for one key depending on browser or platform. Use this tag for questions about the keycode property in a language.

Many languages associate different keys on the keyboard with different numbers, called "keycodes". The keycode is not to be confused with the ASCII character code, though there are some similarities. For example, JavaScript interprets an A keypress as 65 (ASCII code for capital "A") whether or not the Shift key was pressed or Caps Lock was enabled.

For more information about the JavaScript property, see

For more information about the C# KeyEventArgs.KeyCode property, see the Microsoft documentation.

839 questions
16
votes
4 answers

How to catch event.keyCode and change it to another keyCode?

I have checked other questions here at SO, however they do not answer my question. I want to simply catch certain keyCode and replace it with another. I am working with characters, not white spaces, and I do not need to loose focus or the…
esengineer
  • 9,514
  • 7
  • 45
  • 69
16
votes
3 answers

How to trigger backspace on a textfield?

Say I have this: How would i trigger backspace on that textarea possibly using trigger() and key codes. The code for backspace is 8. And i am not looking for this: $('#myarea').val(…
odle
  • 5,172
  • 8
  • 29
  • 33
15
votes
7 answers

How to click home button in iOS simulator?

I want to click home button in iOS Simulator by automation. I just want to know whether it is possible to do click home button using IOS keycode event.
selvi
  • 1,271
  • 2
  • 21
  • 41
14
votes
5 answers

What is the C# equivalent of ChrW(e.KeyCode)?

In VB.NET 2008, I used the following statement: MyKeyChr = ChrW(e.KeyCode) Now I want to convert the above statement into C#. Any Ideas?
Paramu
  • 613
  • 2
  • 10
  • 23
14
votes
3 answers

Jquery: detect if middle or right mouse button is clicked, if so, do this:

Check out my jsfiddle demo, if e.which == 1 then when you left click the h2 it will e.which == 2 or e.which == 3 then it wont work. 2 is the middle mouse button, and 3 is the right mouse button. i found this too: JQuery provides an e.which…
android.nick
  • 11,069
  • 23
  • 77
  • 112
13
votes
3 answers

what is terminal escape sequence for ctrl + arrow (left, right,...) in TERM=linux

I am building a terminal window in a browser (sth. like ajaxterm) and don't know which escape sequence to send to ssh tunnel (opened via paramiko.SSHClient().invoke_shell(term='linux')). I have found a key logger and tried it in a terminal with…
johndodo
  • 17,247
  • 15
  • 96
  • 113
13
votes
8 answers

How to obtain the keycodes in Python

I have to know what key is pressed, but not need the code of the Character, i want to know when someone press the 'A' key even if the key obtained is 'a' or 'A', and so with all other keys. I can't use PyGame or any other library (including…
Lucas Gabriel Sánchez
  • 40,116
  • 20
  • 56
  • 83
13
votes
3 answers

Javascript: Non-unicode char code to unicode character?

I'm having a character code issue with a barcode scanner used to input characters to a web interface. If a barcode has a symbol such as - (a dash/hyphen/minus) it gives me character code 189 which is correct in many character sets. Indeed, if I have…
12
votes
5 answers

Javascript numberpad keycode parsing

I am attempting to parse keydown events from the numberpad with the following: $('#myDiv').keydown(function(e) { val = String.fromCharCode(e.which) }); The problem is that keypad 0-9 return keyCodes of 96-105 which, according to fromCharCode()…
Lee Quarella
  • 4,662
  • 5
  • 43
  • 68
12
votes
8 answers

JavaScript keycode allow number and plus symbol only

I have this JavaScript function that is used to force user only type number in the textbox. Right now and I want to modify this function so it will allow the user to enter plus (+) symbol. How to achieve this? //To only enable digit in the user…
cyberfly
  • 5,568
  • 8
  • 50
  • 67
12
votes
4 answers

KeyCode for the Key ( ? ß \ )

I am using a German Keyboard (shown below) and trying the Robot Class in Java. I am trying to find the KeyCodes for the keys I pressed. It works with getKeyCode(). For example: 'A' is Code: 65, '-' is Code: 45, 'ENTER' is Code: 10 But when I press…
DroiDar
  • 115
  • 1
  • 6
12
votes
2 answers

I have problems with keydown event and autocomplete in Firefox on mac

This is driving me nuts. Its a tough one to explain but I'll have a go. I have one input text field on the front page of my site. I have coded a keydown event observer which checks the keyCode and if its ENTER (or equiv), itll check the input value…
Lee Overy
  • 437
  • 5
  • 13
11
votes
1 answer

KeyEventArgs.KeyData, KeyEventArgs.KeyCode and KeyEventArgs.KeyValue

I have question about the KeyEventArgs's KeyCode and KeyData and KeyValue. KeyCode and Keydata are Keys type, but I don't know what the difference between them is. For KeyValue, I don't know what it is -- it has an int type, does it return the char…
Bosak
  • 2,103
  • 4
  • 24
  • 43
11
votes
2 answers

jquery keypress event object keyCode for firefox problem?

jQuery keypress event for FireFox gives encrypted keyCode property for event object after String.fromCharCode(e.keyCode) conversion but works perfect in Chrome. Following is the javascript code: