开发者

How to Get Text Node with Dojo JS

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 jus开发者_如何学Ct 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>


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


Use dojo.attr(node, 'innerHTML') as textContent does not work in IE

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜