看一下下面的代码片段。它是否为 DOM 中的字符串“test”创建一个文本节点?我可以使用 MooTools 的 jQuery 选择该节点吗?
<div id="foobar">
test <img />
</div>
最佳答案
使用 jQuery:
编辑:
$('#foobar').get(0).firstChild.data;
关于JavaScript:DOM 文本节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2157908/