How to get the highlighted texts?
<p>I am trying to get the selected texts from the user(the highlighted text that user highlights).</p>

<p>I have the following:</p>

<pre><code>function getSelectedTexts(){
  var t = '';
  if(window.getSelection){
    t = window.getSelection();
    console.log('1');
  }else if(document.getSelection){
    t = document.getSelection();
    console.log('2');
  }else if(document.selection){
      console.log('3');
    t = document.selection.createRange().text;
  }
    return t;
   }


 $('.text_speech').live('click',function(e){
      e.preventDefault();
      var textTest='';

      textTest=getSelectedTexts();
      console.log(textTest);

  })
</code></pre>

<p>My console returns</p>

<pre><code>1

&gt;Selection   &lt;------object
 anchorNode: Text
 anchorOffset: 2
 baseNode: Text
 baseOffset: 2
 extentNode: Text
 extentOffset: 1
 focusNode: Text
 focusOffset: 1
 isCollapsed: false
 rangeCount: 1
 type: "Range"
 __proto__: Selection
</code></pre>

<p>I am not sure how to get the selected texts. Anyone can help me about it? Thanks a lot!</p>
