Possible Duplicate:
How to identify when the DOM has been changed?
Let's suppose I have access to the <ul>
element $(ul#mylist)
.
How can I trigger the event when some item is added to the list.
I tried the following but actually it does not work.
$('ul#mylist').change(function () {
console.log('added an element');
});
You can try listening to DOMNodeInserted
event
$('ul#mylist').on('DOMNodeInserted' ,function () {
console.log('added an element');
});
If you are adding a li to ul and want to Listen to the event..
Check DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With