title: Dispatch / generate keydown event in Vanilla JS (no jQuery, use Vanilla JS)
body: <p>How can I simulate a keypress to an input, <strong><em>using vanilla javascript</em></strong>?</p>
  
  <p>I have tested every possible answer on SO and elsewhere, and it doesn't work on Chrome or Firefox.</p>
  
  <p>For example, let's say we have a form:</p>
  
  <pre><code>&lt;input id="myInput" type="text"&gt;
  &lt;button id="myButton&gt;Click Me&lt;/button&gt;
  </code></pre>
  
  <p>How could I make it so that when the button is clicked, the letter "a" is added to the input?</p>