如何使用DOMNodeInserted从新插入的元素中获取文本。
示例:
<div id='elementID'>
<span class='elementClass'>Some text</span> <!-- already present -->
<span class='elementClass'>Some text</span> <!-- already present -->
<span class='elementClass'>Some text</span> <!-- newly inserted -->
...
</div>
答案 0 :(得分:0)
您可以通过event.target
获取$('#elementID').on('DOMNodeInserted', function(e) {
console.log($(e.target).text());
});