Skip to content

Instantly share code, notes, and snippets.

@RockyMyx
Created May 13, 2013 06:03
Show Gist options
  • Save RockyMyx/5566437 to your computer and use it in GitHub Desktop.
Save RockyMyx/5566437 to your computer and use it in GitHub Desktop.
JavaScript: getSelection.js
if (document.selection) {
//IE
alert(document.selection.createRange().text);
}
else if (window.getSelection()) {
//Firefox, Chrome ...
alert(window.getSelection());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment