如何使用Dojo JS获取文本节点

voi*_*ate 4 javascript dojo dom

我试图从标签中获取文本 - 但该标签有一个嵌套节点,我也不想要.我如何获得文本?

例如

<div id="i_want_the_text_in_this_div">
  <span id="but_not_this_one">
   ignore this text
  </span> 
  keep this text
</div>
Run Code Online (Sandbox Code Playgroud)

pp1*_*9dd 7

尝试: dojo.query('#i_want_the_text_in_this_div')[0].lastChild.textContent;