Receipt of textarea



  • Good evening, I've got the problem of getting the text just out of textarea for a long time, swinging in the google, but I haven't found anything, some checks on the browser, and it's not just textarea that she's taking over the whole document. Can we put this on jquery?



  • A little google, https://stackoverflow.com/questions/275761/how-to-get-selected-text-from-textbox-control-with-javascript

    function ShowSelection()
    {
      var textComponent = document.getElementById('Editor');
      var selectedText;
      // IE version
      if (document.selection != undefined)
      {
        textComponent.focus();
        var sel = document.selection.createRange();
        selectedText = sel.text;
      }
      // Mozilla version
      else if (textComponent.selectionStart != undefined)
      {
        var startPos = textComponent.selectionStart;
        var endPos = textComponent.selectionEnd;
        selectedText = textComponent.value.substring(startPos, endPos)
      }
      alert("You selected: " + selectedText);
    }
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2