Faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

10 of 20 people (50%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

How to change _selected text_ in textarea to _[TAG]selected text[/TAG]_

Dec 1st, 2001 17:12
Dave Clark, Konstantin -,


Konstantin,
This may not be the answer you're looking for; because, it is not 
specific to a TEXTAREA.  It will replace whatever text is highlighted --
 no matter where it is in the displayed document area (IE only):
var textRangeObject = document.selection.createRange();
textRangeObject.text = "some text";
Take care,
Dave Clark