Alternate API for TextRange.findText() API to use with Range object in IE11 RRS feed

  • Question

  • We used to use TextRange.findText() API to find the text in the specified TextRange in the forward direction and passing in a parameter "-1" to the API i.e TextRange.findText(<some_text_to_find>, -1) we were able to find the Text in the reverse direction for IE<11 in our solutions.

    Since TextRange has been deprecated in IE11, is there any other alternate API for TextRange.findText() that could be used with Range object that would provide the same functionalities as TextRange.findText()

    Monday, April 27, 2020 9:06 AM

All replies

  • You could try to use JavaScript String indexOf() Method or the JavaScript Regular Expressions to find the text.

    The indexOf() method returns the position of the first occurrence of a specified value in a string. This method returns -1 if the value to search for never occurs.

    The String search() method searches a string for a specified value and returns the position of the match, if not contains the specified value it will return -1'

    • Proposed as answer by Zhi Lv Monday, May 4, 2020 2:09 AM
    Monday, April 27, 2020 11:40 AM