XML DOM deleteContents() method

Definition and usage

The deleteContents() method deletes the area of the document.

Syntax:

deleteContents()

Throw

If the part of the document represented by the current range is read-only, this method will throw a NO_MODIFICATION_ALLOWED_ERR with the code DOMException exception.

Description

This method will delete all document content represented by the current range. When this method returns, the boundary points of the current range will coincide.

Note:This deletion operation can generate adjacent Text nodes, call Node.normalize() The method can merge these nodes.

Refer to

For methods to copy document content, please refer to Range.cloneContents().

For methods on copying and deleting document content, please refer to Range.extractContents().