Reputation: 4783
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
Upvotes: 0
Views: 2257
Reputation: 775
jQuery("<BigParent><Parent><Child>Please get my value!!!</Child></Parent></BigParent>").find("Child").text()
returns the value
Upvotes: 0