I’m trying to use keyCode 127 for the delete key, but when I press the key, my function does not run. When I type Alt + 0127 it runs my function. Can someone explain to me what is wrong… I’ll give you a code snippet below.
No, 46 is the periord, “.” button. I’ve tried http://keycode.info/, but those codes are incorrect in this case, you have to use the ASCII keycodes found on http://www.theasciicode.com.ar/ascii-codes.txt, these are the keycodes that I know work for a-z, A-Z, and 0-9. On there it says delete is 127 and it works with Alt + 0127 but not the delete button itself.
I’ve also found that if you try to use the keycodes for F1 - F12, they don’t work, at least on google chrome. I feel these keys are reserved in google chrome’s browser, but I could be wrong and its the case for all browsers. I would try Microsoft Edge but you know, it’s a Microsoft browser, therefore it doesn’t like me.
Yes, but when I use keycode 46, it works for the “.” key and not the delete key like you say. Its weird and I don’t understand why this is the case but even with the “f” key, it should be 70, but it is 102.
I understand what the keyCodes are, but if you put that inside of my script, they don’t work for the keys they should. Is there possibly something wrong with my script?
UPD: look below for answer, basically use keydown instead of keypress event.
So I’ve made small project, with similar example.
And it works all as intended. Launch it and press Delete, look in console.
In your code you call setup once, then it uses value of that key, so it means if you change enableKey attribute during your app running, it wont update.
Although code I’ve shared, will do take in account actual enableKey field, so it changeable in runtime.
hey my spike tank or anything for that matter will not move. the code editor does not understand keyboard or arrow_key or anything else can you help me out