Using Vanilla JS (not jQuery), I want to dispatch a keyboard event with some info about the key that should be pressed, and I want the result to appear in the text area.
var textarea = document.querySelector('textarea');
var keyEvent = new Event('keypress', {
key: 'a',
location: 0,
which: 65,
code: 'KeyA'
});
textarea.dispatchEvent(keyEvent);
<textarea></textarea>