Created
July 21, 2017 16:27
-
-
Save garystorey/01074fd1d48f425104772b8a6e458b4e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 selectText(e,r,s,d) { | |
| d = document; | |
| if (s = window.getSelection) { | |
| (r = d.createRange()).selectNode(e); | |
| (s = s()).removeAllRanges(); | |
| s.addRange(r); | |
| } | |
| else if (d.selection) { | |
| (r = d.body.createTextRange()).moveToElementText(e); | |
| r.select(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment