title: Javascript: Keep text selected in div when focusing textbox
body: <p>I'm working on a wysiwyg editor for my blog application on my website.
  I've already written some basic editor commands like bolding, italic style and that stuff...
  Now the problem is, when I wan't to do a command which needs additional information like a hyperlink.
  I got a div with contentEditable on true and a textbox where I can put in the URL for the hyperlink.</p>
  
  <p>I looked up in this forum and other places but I didn't find any possible solution on how to select text in the editable div, then put the desired url for the hyperlink in the textbox and finally click on a div button to call the <code>document.execCommand("CreateLink", null, $URL);</code> function in javascript.</p>
  
  <p>Is there a possibility to select the text, then on focusing the textbox, save the position of the start and end of the selection and on clicking the button select the text again, with the saved range positions to affect the hyperlink?</p>