Last active
October 12, 2019 17:50
-
-
Save GitHub30/53fe7ed6eb7a4ac675b4ae93e20fd524 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function insertAtCaret(text) { | |
if(!document.activeElement.setRangeText) return; | |
document.activeElement.setRangeText( | |
text, | |
document.activeElement.selectionStart, | |
document.activeElement.selectionEnd, | |
'end' | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment