Special Case: Unable to insert text in textarea on cursor position in Browser using JavaScript
I want to insert text in Instagram Chat textarea using javascript Instagram textarea(in messages tab) can be accessed by using…. const textArea = document.getElementsByClassName("_ab5y")[0].getElementsByClassName("_acrb")[0].children[1].getElementsByTagName("textarea")[0]; the value can be inserted easily using… function setKeywordText(text) { textArea.value = text; var evt = document.createEvent("Events"); evt.initEvent("input", true, true); textArea.dispatchEvent(evt); } setKeywordText("Hello!"); But, Unable to Insert text on cursor position.… Read More Special Case: Unable to insert text in textarea on cursor position in Browser using JavaScript