Thursday, 8 August 2013

Getting child node value of child's child

Getting child node value of child's child

Below I have code to find the node value of 'TheNode'. I need to adapt
that code so that it gets the node value of <Child>. How can this be done?
XML:
<BigParent>
<Parent>
<Child>Please get my value!!!</Child>
</Parent>
</BigParent>
JavaScript (that needs changing (so I can find <Child> value)):
$(data).find('TheNode').each(function() {
var childNode = this.childNodes[0];
var childNodeValue = childNode.nodeValue;
});
Thanks

No comments:

Post a Comment