deleteContents
Summary
Removes all contents within a selected range.
Syntax
var object = object.deleteContents();
Return Value
Returns an object of type NumberNumber
Type: HRESULT
This method can return one of these values.
| Return code | Description | 
|---|---|
| S_OK | The operation completed successfully. | 
| InvalidStateError | detach has been invoked on the object. | 
| W3Exception_DOM_NO_MODIFICATION_ALLOWED_ERR | Some of the contents or nodes are read-only. | 
Examples
var range = document.createRange();
range.selectNode(document.getElementsByTagName("div").item(0));
range.deleteContents();
Notes
Remarks
If the deleted range contains closing or opening tags, the remaining tags are completed.
Syntax
Range.deleteContents();
Standards information
Related specifications
- DOM
 - Living Standard
 
Attributions
Mozilla Developer Network
: [Range.deleteContents Article]Microsoft Developer Network: [deleteContents Method Article]