removeNode method
Removes the object from the document hierarchy.
Syntax
*object.*removeNode(fDeep)
Parameters
fDeep [in, optional]
Type: Boolean
A Boolean that specifies one of the following values.
false (false)
Default. childNodes collection of the object is not removed.
true (true)
childNodes collection of the object is removed.
Return value
Type: IHTMLDOMNode
Returns a reference to the object that is removed.
Standards information
There are no standards that apply here.
Remarks
This property is accessible at run time. If elements are removed at run time, before the closing tag is parsed, areas of the document might not render.
Examples
This example uses the removeNode method to remove a table from the document hierarchy.
<!DOCTYPE html>
<html>
<head>
<title>removeNode</title>
</head>
<body>
<table id="oTable">
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
</tr>
</table>
<input type="button" id="oInput" value="Remove Table">
<script>
var oInput = document.getElementById('oInput');
oInput.addEventListener('click', fnRemove, false);
function fnRemove() {
// 'true' possible value specifies removal of childNodes also:
document.getElementById('oTable').removeNode(true);
oInput.removeEventListener('click', fnRemove, false);
}
</script>
</body>
</html>
See also
Reference
Conceptual