0

How do I go about getting the text from a newly inserted element using DOMNodeInserted.

Example:

<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>

1 Answers1

0

You can get it via event.target

$('#elementID').on('DOMNodeInserted', function(e) {
    console.log($(e.target).text());
});​

http://jsfiddle.net/Pccwc/

wirey00
  • 33,517
  • 7
  • 54
  • 65