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.deleteContents() - removes and discards the contents of the range from the document.Range.extractContents() - removes and copies the contents of the range from the document.Range.cloneContents() - leaves the fragment in place but creates a copy that can be inserted elsewhere.