Javascript E4X - Return the text of node and its children?

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2012-07-28T00:46:48Z Indexed on 2012/12/08 17:04 UTC
Read the original article Hit count: 173

Filed under:
|

I'm trying to parse some of html where there is are repeating lines of code such as:

<a>This is <span>some text</span> but its <span>not grabbing the span</span> content</a>

So I am looping through the object and extracting this:

object.a[i].text();

but its only returning

"This is  but its  content"

How do I grab the text within the children nodes as well, all as one string?

Cheers

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about e4x