Is there a function to detect if a new element injection has been made to the DOM? Instead of constantly checking after my ajax call to see if there's new images injected like so:
$.ajax({
...
...
success: function(data) {
$('.content').replaceWith(data);
if ($(data).find('img').length) alert('New images found!');
}
});
I was hoping there's a function out there that exists to check if new images was added to the DOM. Example:
$('img').injected(function() {
console.log('Found new images: ' + this);
});