This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
How to select/highlight a portion of text in a textarea programmatically using javascript? For example. There is a text box which is having values let us as 1234 ABCD. Onload I want to select/highlight the characters AB.
Michael McNally
Ranch Hand
Joined: Aug 22, 2002
Posts: 53
posted
0
You need to make a RegExp (regular expression) for this. THe RegExp below searches text in an object. When it finds any a character followed by any b character...it finds a match for a function you can then create such as select() for a text object. I am not sure about this but here is my guess: text.select('/([aA][bB])/') i am sure about the RegExp but not sure if i wrote it correctly. im not even sure if i implemented it correctly.