Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

highlighting a few characters in a text box

Status
Not open for further replies.

csbdeady

Programmer
May 18, 2002
119
GB
Hi

If I have a text box or a textarea on a form that is dynamically pre-populated, is it possible in HTML, CSS or Javascript to specify just a portion of the text to be highlighted (ideall with the field having focus)?

For eg:

If I have a text box on a form with the followin pre-populated:

aa bb cc

Can I have it so that the text (between the * in the example) is highlighted as though the cursor had been dragged across it? :

aa *bb* cc

Thanks
-Colin
 

As far as I know, this can only be done in IE, using text ranges... So if you're after a cross-browser, or cross-platform solution, you might be out of luck.

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top