Range: deleteContents() method

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

js
deleteContents()

Parameters

None.

Return value

None (undefined).

Examples

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

Specifications

Specification
DOM Standard
# dom-range-deletecontents

Browser compatibility

BCD tables only load in the browser

See also