Hello bold World
|
|
var range = document.createRange();
Range.setStart(refNode, startOffset)
refNode
- the node that starts the selection.startOffset
- the number of chars skipped before the range starts if it's a text node; otherwise it's index of the first child node in the range.Range.setEnd(refNode, endOffset)
refNode
- the node that ends the selection.endOffset
- the number of chars skipped before the range ends if it's a text node; otherwise it's index of the last child node in the range.Range.insertNode(refNode)
- inserts a node at the beginning of the selection. refNode
is the node to be inserted.Range.surroundContents(refNode)
- surrounds the range with the node specified in refNode
.