Might be over simplifying things, but couldn't you simply alter the .val()
(value) of the input field to simulate auto-written values
?
You could simply set the value like this -
$("#example").val('Some auto-written value');
Of you could do something a little more visual like this -
var autoText = ['f','o','o','b','a','r'];
var characterIndex = 0;
var autoType = setInterval(function(){
$("#example").val( $("#example").val() + autoText[characterIndex] );
characterIndex++;
if (characterIndex >= autoText.length){
clearInterval(autoType);
}
},_keystroke_interval);
The _keystroke_interval
is the interval (in milliseconds) between the auto typed characters. The autoType
interval variable will iterate through all the indexes of the autoText
array and for each iteration it will append one character to the input field.
This will give you more of an auto-typing feel...
here is a working jsFiddle example