Is There any possible way to display only one character when a key is pressed DOWN for a longer period of time what I mean is when I press lets say ‘s’ DOWN for a longer period of time I want only ‘s’ displayed and I don’t want this to happen ‘ssssssssssssssssssssssssssssssssssssssss….’ .
And whit out using this method because this brings on the problem that if a user types fast and presses two keys at the same time only the second one will get displayed for example if I press down ‘k’ and press down whit out letting ‘k’ go the ‘p’ only the ‘p’ will get displayed.
var textarea='';
document.getElementById('textareaID').onkeydown=keydown;
document.getElementById('textareaID').onkeyup=keyup;
function keydown () {
this.value=textarea;
}
function keyup () {
textarea=this.value;
this.value=textarea;
}
And please do not say using counters because it doesn’t work for some reason believe me I have tried for the last 3 days.
http://toki-woki.net/lab/long-press/ this is what i am basically trying to do but I cant understand how the part where you hold the key down and only one is displayed out is done and of course if i press a key and while the key is down i press another one both of them get displayed rest is easy.
So i would love and explanation its driving me crazy.
Alright I think I got it.
1: On keydown cancel the input to the textarea.
2: On keyup put in the clicked letter.
Here is the code (there are comments so you can see what’s going on):
http://jsfiddle.net/NerfAnarchist/gXVuC/