Skip to content

Instantly share code, notes, and snippets.

@iros
Created February 23, 2009 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iros/69017 to your computer and use it in GitHub Desktop.
Save iros/69017 to your computer and use it in GitHub Desktop.
Javascript: Get the range of selection in window
var sel = window.getSelection();
var range = document.createRange();
range.setStart( sel.anchorNode, sel.anchorOffset );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment