XML DOMLesson 43Free preview
DOM Add Nodes
This lesson is part of XML · All levels
Summary
The already created nodes are attached to the tree using the appendChild at the end of the child list, or insertBefore to place before a particular node. Modern APIs provide more compact appends and prepends. The correct placement determines the order in which the data appears on the document.
Key points
- AppendChild adds the node as the last child
- InsertBefore placing the node before a particular child
- Append and prepend are modern DOM APIs that are concise
- The node that already has the parent will be moved, not duplicated.
- The addition order determines the display order
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.