Skip to content

Instantly share code, notes, and snippets.

@formido
Created December 12, 2008 06:21
Show Gist options
  • Save formido/35035 to your computer and use it in GitHub Desktop.
Save formido/35035 to your computer and use it in GitHub Desktop.
var range = window.getSelection().getRangeAt(0);
var offset = range.startOffset;
var container = range.commonAncestorContainer;
var containerText = container.nodeValue;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment