How to set focus and set the text in input text using createEvent and dispatchEvent?
<p>I'm trying to write a code in Javascript, which should set the cursor focus on the input textbox and should trigger a "keypress" event which should set key, say letter 'A' in the textbox. </p>

<p>How to do it? I read we can achieve using <code>createEvent</code> and <code>dispatchEvent</code>. Any Suggestions?</p>