The HTML DOM Range setStartAfter() method sets the starting position of a Range. An element used to set the starting point range is referenceNode element. In this method, the reference element used is not included in the range.
- referenceNode element: The Node which is used to set the starting of the range.
Return Value: This method has no return value.
Example: This example will show how to set the starting of the range using setStartAfter(). Also in this example, I had also used setEndAfter() method to set the ending of the range. The start reference node here is the first <i> element of the document.
For reference, i had also console logged the range in the text to make it clear.
Output: In console, range made with startOffset and endOffset can be seen.
- Google Chrome