XML DOMLesson 39Free preview
DOM Change Nodes
This lesson is part of XML · All levels
Summary
Changing a document through DOM can be done by replacing the textContent or nodeValue for the text, and the attribute set for the attribute. The changes are directly visible on the document object so the view changes without rewriting the entire page. This approach becomes the basis for dynamic content updates.
Key points
- TextContent replaces the entire text content of an element
- NodeValue changes value on the text node or attribute node
- SetAttribute sets or changes the value of the attribute
- The DOM changes are directly reflected in the active document
- Updating some nodes is more efficient than rebuilding a page
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.