More complex example can be found here: <a href="http://h123.ru/-/tests/KeyboardEvent/"> http://h123.ru/-/tests/KeyboardEvent/ </a>
<br>
This demo uses polyfill from <a href="https://github.com/termi/DOM-Keyboard-Event-Level-3-polyfill">https://github.com/termi/DOM-Keyboard-Event-Level-3-polyfill</a>
<hr>
<h3>Enter some text with uppercase and lowercase letters:</h3>
<input id='in' />
<h3>Click button to create sintetic KeyboardEvent with predefined 'a' "key" and "char"</h3>
<button id=click><span>click to me to create a synthetic event</span></button>
<br>
<div id="output" style="background:green;min-height:40px">
</div>
<!--[if lt IE 8]>
<script src="//h123.ru/js/a.ielt8.js"></script>
<![endif]-->
<!--[if IE 8]>
<script src="//h123.ru/js/a.ie8.js"></script>
<![endif]-->
<script src="//h123.ru/js/a.js"></script>
<script src="//h123.ru/js/DOMEventsLevel3.shim.js?1"></script>