Name
Range.deleteContents(): delete a region of the document — DOM Level 2 Range
Synopsis
void deleteContents( )
throws DOMException;Throws
If any portion of the document that is represented by this
range is read-only, this method throws a DOMException with a
code of NO_MODIFICATION_ALLOWED_ERR.
Description
This method deletes all document content represented by this
range. When this method returns, the range is collapsed with both
boundary points at the start position. Note that the deletion may
result in adjacent Text nodes that can be merged with a call to
Node.normalize( ).
See Range.cloneContents( )
for a way to copy document content and Range.extractContents( ) for a way to copy
and delete document content in a single operation.
See Also
Node.normalize( ), Range.cloneContents( ), Range.extractContents( )
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access