+ 4
How do I write a command to press a key?
How do I make a key press? For example make the key âaâ press, with a JavaScript code?
8 Answers
+ 6
Hope this helps
https://stackoverflow.com/questions/596481/is-it-possible-to-simulate-key-press-events-programmatically
I didn't know that...đ¤
+ 5
CalviŐ˛ Your code looks like if you're pressing a key but it's an illusion.
+ 3
<input id="in1" type="text" />
<script>
const in1 = document.getElementById('in1');
in1.value = in1.value + 'a';
</script>
+ 2
What do you mean by "press itself"? What's the purpose of doing that?
+ 2
Ginfio Just update the input with value property
+ 1
Ok, it looks like I should explain a little further...
On this typing game called "Nitro Type", I'm trying to see if I could attempt to make an auto typer because there isn't a working one at the moment.
When you go to race (to type), the text you are gonna type comes up.
For example if the first letter is a "D", you press the key "D", if the next letter is a "c", you type "c", ... and so on.
So, first I need to know how I can make that "D" (for example) press itself.
... the website: https://www.nitrotype.com/race
+ 1
CalviŐ˛ I mean like: thereâs an input and you want to type âbâ, you donât actually physically press the key, but somehow with some code type b in the input.
Auto typer.
+ 1
try updating the input with value property as you are doing but with delay, like using timer so that you can get the visual effect of typing