I want something like:
$('.pac-container').whenAddToDom(function(){
console.log('element with class pac-container added to DOM');
//I want to use this added element $(this).doSomethingWithThis();
});
I want something like:
$('.pac-container').whenAddToDom(function(){
console.log('element with class pac-container added to DOM');
//I want to use this added element $(this).doSomethingWithThis();
});
I would wrap the elements that will be appended in a container and do something like this:
$("html").bind("DOMNodeInserted",function(){
console.log('element with class '+$("#container > *").attr('class') +' added to DOM');
});
Here's a fiddle http://jsfiddle.net/PgAJT/295/
This is solution to my problem:
$(document).bind('DOMNodeInserted DOMNodeRemoved', function(element){
if($(this).hasClass('pac-container')){
console.log(element.target);
}
});