javascript Node appendChild( )
appendChild( ) | Firefox/Netscape/NN 6 IE 5 Chrome/Safari/DOM 1 |
appendChild(nodeObject) | |
Inserts a new node after the end of the last child node of the current node object. The current node object must be capable of containing child nodes, otherwise the method throws an exception. This method is the most common way to append a dynamically created element, text node, or document fragment to an existing element, such as a script might do when assembling a chunk of new content for a document. But if the node reference passed as a parameter with the appendChild( ) method points to an existing node in the document tree, that node is first removed from the tree, and then appended to the end of the list of child nodes in the current object. This provides a shortcut way to move a node from one location to the end of a container. |
|
Appending one text node as a sibling to an existing text node does not join the two text nodes together. To combine all sibling text nodes into one large text node, invoke the parent's normalize( ) method. |
|
Parameters | |
|
|
Returned Value | |
Reference to the appended node. |
Powered by Linode.