0

Suppose my textBox Value is "Hello, How are you?" and when I select How are you? then I want selected text in an alert box.

Please help me!

Thanks!

Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107
Afzal
  • 132
  • 10
  • 1
    use `split` method..... or `indexOf` method with `slice`(`substr` or `substring`) – Pranav C Balan Nov 07 '16 at 07:17
  • 1
    Possible duplicate of [How to get selected text from textbox control with javascript](http://stackoverflow.com/questions/275761/how-to-get-selected-text-from-textbox-control-with-javascript) – Tuhin Nov 07 '16 at 07:18
  • http://stackoverflow.com/questions/275761/how-to-get-selected-text-from-textbox-control-with-javascript – Tuhin Nov 07 '16 at 07:18
  • 1
    Thanks for reply me! I got it answer here what i want exatly. http://jsfiddle.net/rT5vR/ – Afzal Nov 07 '16 at 07:23
  • According to [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/getSelection) there is no difference between `window.getSelection()` and `document.getSelection()`. – Zev Spitz Nov 07 '16 at 08:43

0 Answers0