Range.deleteContents()

The Range.deleteContents() method removes the contents of the Range from the Document.

Unlike Range.extractContents(), this method does not return a DocumentFragment containing the deleted content.

Syntax

range.deleteContents()

Example

range = document.createRange();
range.selectNode(document.getElementsByTagName("div").item(0));
range.deleteContents();

Specifications

Specification
DOM Standard (DOM)
# dom-range-deletecontents

Browser compatibility

BCD tables only load in the browser

See also