Home › Forums › General XMetaL Discussion › Getting all the text children of an element in a script › Reply To: Getting all the text children of an element in a script
Reply to: Getting all the text children of an element in a script
March 15, 2010 at 8:43 pmOk, I figured it out. Have to use a tree walker:
[code]function readtree(node) {
// Read the DOM tree
// Do if this is a DOMText node
if (node.nodeType==3) {
titleText += node.data;
}
// Process this node's children
if (node.hasChildNodes()) {
readtree(node.firstChild);
}
// Continue with this node's siblings
if (node.nextSibling != null) {
readtree(node.nextSibling)
}
}[/code]