javascript - MutationOberserver should observe iframes -


currently use observer attach click event first event handler dynamically created elements. unfortunately doesn't work elements within dynamically created iframe.

elementobserver = new mutationobserver(function (mutations) {   mutations.foreach(function (mutation) {     $(mutation.target).bindfirst('click', my.callback.function);   }); });  elementobserver.observe(document.body, {childlist: true, subtree: true}); 

the bindfirst() function looks like:

$.fn.bindfirst = function(name, fn) {    this.on(name, fn);    this.each(function() {       var handlers = $._data(this, 'events')[name.split('.')[0]];       var handler = handlers.pop();       handlers.splice(0, 0, handler);    }); }; 

but my.callback.function won't triggered within iframe. how can solve problem my.callback.function gets triggered in iframe well.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

Qt QGraphicsScene is not accessable from QGraphicsView (on Qt 5.6.1) -

What is happening when Matlab is starting a "parallel pool"? -