Is there a way to programmatically (using JS) start a keyboard event flow on an input[type=text]
or textarea
?
I mean that I want to make the element write a character as if the user has used the keyboard to do it. Meaning, it will consider the caret position, text selection, overwrite\insert state, CAPS-LOCK state, and so on.
Existing solutions (and questions) I've found don't give me that result, but just trigger a keydown
or some other keyboard event on that element. I want to do something like:
document.getElementById('input').pressKey('e');
The solution has to be cross-browser (Firefox, Chrome and IE8+), and should not contain external plugins such as Adobe Flash - only things that can be sent with a web page.