ProblemYou want to replace text. SolutionUse the replaceSelectedText( ) method to replace the highlighted text and replaceText( ) to replace a range of text. DiscussionThe replaceSelectedText( ) method enables you to replace the selected text in a text field. Simply pass the method the string to use as the replacement text. For the method to work, the text field must have focus: _field.replaceSelectedText("new text"); Use the replaceText( ) method to replace text within a text string given a starting and ending index. The following replaces the text from index 100 to index 150, with the new string specified by the third parameter: _field.replaceText(100, 150, "new text"); |