Skip to content

Instantly share code, notes, and snippets.

View Aditya-Basak's full-sized avatar

Aditya Basak Aditya-Basak

  • University of Califorina, Irvine
  • San Jose
  • 06:20 (UTC -07:00)
View GitHub Profile
function dispatch(target, eventType, char) {
var evt = document.createEvent("TextEvent");
evt.initTextEvent (eventType, true, true, window, char, 0, "en-US");
target.focus();
target.dispatchEvent(evt);
}
dispatch(document.querySelector("#compose-input div"), "textInput", "hello!");