Skip to content

Instantly share code, notes, and snippets.

View nayan2000's full-sized avatar
🎯
Focusing

Nayan Khanna nayan2000

🎯
Focusing
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!");