I am trying to get the text from within a tag - but that tag has a nested node, too which I don't want. How do I just get the text?
For example
<div id="i_want_the_text_in_this_div">
<span id="but_not_this_one">
ignore this text
</span>
keep this text
</div>
I am trying to get the text from within a tag - but that tag has a nested node, too which I don't want. How do I just get the text?
For example
<div id="i_want_the_text_in_this_div">
<span id="but_not_this_one">
ignore this text
</span>
keep this text
</div>
Share
Improve this question
asked Sep 21, 2010 at 15:31
voidstatevoidstate
7,9904 gold badges45 silver badges53 bronze badges
2 Answers
Reset to default 7Try: dojo.query('#i_want_the_text_in_this_div')[0].lastChild.textContent;
Use dojo.attr(node, 'innerHTML')
as textContent
does not work in IE