我正在尝试从标签中获取文本 - 但该标签也有一个我不想要的嵌套节点。我如何才能获取文本?
例如
<div id="i_want_the_text_in_this_div">
<span id="but_not_this_one">
ignore this text
</span>
keep this text
</div>
最佳答案
尝试:dojo.query('#i_want_the_text_in_this_div')[0].lastChild.textContent;
关于javascript - 如何使用 Dojo JS 获取文本节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3761864/