Insert text before and after the selected text in javascript
<p>I want to put some specified text (where possible/any editable field) before and after any selected text in an HTML document.
<code>document.getSelection()</code> or <code>document.selection.createRange().text</code> returns only the text itself not the position. 
Is there anyway to replace the selected text? Anyway to insert specific text before and after selcted text anywhere in the document?</p>
