Snippets

Get text selection

Support: IE6, Fx2, Opera9, Safari Cross browser getSelection().

function getSelection() {
	return (!!document.getSelection) ? document.getSelection() :
	       (!!window.getSelection)   ? window.getSelection() :
	       document.selection.createRange().text;
}

Source: http://snipplr.com/view/775/getselection/...

Share this snippet

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Please respect the following rules: No advertising, no spam, no keyword in name field. Thank you!