Share via


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

acronym

address

applet

area

article

aside

attribute

b

base

baseFont

bdo

bgSound

big

blockQuote

body

br

button

caption

center

cite

code

col

colGroup

comment

dd

del

dfn

dir

div

dl

documentType

dt

em

embed

fieldSet

figcaption

figure

font

footer

form

frame

frameSet

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

listing

map

mark

marquee

menu

nav

nextID

object

ol

option

p

plainText

pre

ProcessingInstruction

q

s

samp

script

section

select

small

span

strike

strong

sub

sup

table

tBody

td

textArea

tFoot

th

tHead

title

tr

tt

u

ul

var

xmp

Reference

appendChild

cloneNode

insertBefore

Conceptual

About the W3C Document Object Model