views:

777

answers:

1

I'm not familiar with such attributes,

can someone provide a simple demo?

I need it to be done without any libraries.

+5  A: 

Stackoverflow Archive


Hint: Before asking a question, look to Google:

site:stackoverflow.com javascript get selected text within textarea

Returns only relevant material from stackoverflow.com

Alternatively, you can type the same exact thing into your address bar following a ? to go to the first result. Give it a shot, type the following into your Firefox address bar:

?site:stackoverflow.com javascript get selected text within textarea

Jonathan Sampson
+1 for a explanation instead of whining, or posting a "lmgtfy.com" link.
TFM
ty,but i don't want to any libs,in that post,how to retrieve selected text from `range` is not shown,seems.
Shore
The second link doesn't use a library.
Jonathan Sampson
Additionally, we constantly go round'and'round about jQuery - you really should just use the framework. You ask numerous questions every week that would easily be fixed by implementing a very lightweight framework. Use the google-hosted version, and many of your visitors won't even have to download it when visiting your site.
Jonathan Sampson
http://stackoverflow.com/questions/717224/how-to-get-selected-text-in-textarea/717229#717229
Patrick McElhaney