Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Removes the object from the document hierarchy.
*object.*removeNode(fDeep)
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.
Type: IHTMLDOMNode
Returns a reference to the object that is removed.
There are no standards that apply here.
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.
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>
Reference
Conceptual
Please sign in to use this experience.
Sign in