Expand Minimize

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

a
abbr
address
area
article
aside
attribute
b
base
bdo
bgSound
blockQuote
body
br
button
caption
cite
code
col
colGroup
comment
dd
del
dfn
div
dl
documentType
dt
em
embed
fieldSet
figcaption
figure
footer
form
frame
head
header
hgroup
hn
hr
html
i
iframe
img
input type=button
input type=checkbox
input type=email
input type=file
input type=hidden
input type=image
input type=number
input type=password
input type=radio
input type=range
input type=reset
input type=search
input type=submit
input type=tel
input type=text
input type=url
ins
kbd
label
legend
li
link
map
mark
menu
nav
object
ol
option
p
pre
ProcessingInstruction
q
s
samp
script
section
select
small
span
strong
sub
sup
table
tBody
td
textArea
tFoot
th
tHead
title
tr
u
ul
var
Reference
appendChild
cloneNode
insertBefore
Conceptual
About the W3C Document Object Model

 

 

Show:
© 2014 Microsoft