inRange method (TextRange)
You can also use the compareEndPoints and isEqual methods to compare the placement of two TextRange objects in Internet Explorer.
You can find the related objects in the Supported by objects section below.
|Required. Reference to a TextRange object to compare.|
Boolean. One of the following values:
|The current TextRange does not contain the specified TextRange object.|
|The current TextRange contains or equal to the specified TextRange object.|
Example HTML code 1:
This example illustrates the use of the inRange method. If the current selection is the text content of an element and a range is aligned to the text content of the element and another range is created from the current selection, then the inRange method returns false. Conclusion: use the compareEndPoints method for TextRange comparison.
Did you find this example helpful?
User Contributed Comments