A bit of context: I'm working on an HTML5-based mobile application with an autocomplete function that breaks on Android due to an error in setSelectionRange: http://code.google.com/p/android/issues/detail?id=15245 Because of this, I cannot directly manipulate the text in the text box, as usual. To get around this problem, I planned to manually trigger several key events to simulate keystrokes on the Android keyboard.
All the solutions that I found in Is it possible to programmatically simulate key events for the press? and Keyboard Dismissal An event in JavaScript simply fires an event without actually creating text input.
Is there a way to simulate an entire keystroke event, including text input using javascript?
Update: fixed (grade)
I got around this problem by writing a plugin for Trigger (the shell used) that manually fires events on the Android keyboard at the native level. It was located here: http://bit.ly/RiJqrM , if anyone else is interested.
Another update:
Further disappointment and subsequent testing led me to the full circle, and it turns out that the aforementioned android error could be a little red herring. The reason my carriage behaved strangely is actually probably due to some combination of autocomplete on my native android and the fact that jQuery focus () doesn't work at all on android (shameless self-promotion): Android JQuery focus () workaround
Marsh marsh
source share