title: Javascript: how can I get text outiside of selected text range
body: <p>I know how to get the text from selected range through:</p>
  
  <pre><code>if (elem.getSelection) {
          sel = elem.getSelection();
          if (sel.rangeCount) {
               selectedText=sel.getRangeAt(0);
          }
      } else if (elem.selection) {
          selectedText=elem.selection.createRange();
      }
  </code></pre>
  
  <p>Question - how can I get the text before selected range and after?
  Thanks in advance.</p>