JSFiddle - React, Tailwind, and code Playground

by Aaron von Schassen

HTML

<input type="text" id="writeToMe">

JavaScript

var evt = new MouseEvent("click", {
  bubbles: true,
  cancelable: true,
  view: window
});
document.getElementById('writeToMe').dispatchEvent(evt);

$("input").click(function () {
var e = new KeyboardEvent("keydown", {
  key: "Q",
  char: "Q"
});

	console.log("test");
	document.getElementById('writeToMe').dispatchEvent(e);
});