The splitText() method breaks the Text node into two nodes at the specified offset index, keeping both nodes in the tree as siblings.
After Splitting the text, the main node contains all the content up to the specified offset index point, and a newly created node of the same type contains the remaining text.
- offset index: The index immediately before which to break the text node.
- Returns the new created Text node that contains the text after the offset index.
In console, the two splitted text Nodes can be seen.
- Google Chrome