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?

11 of 21 people (52%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

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

Apr 5th, 2008 20:47
ha mo, 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
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com