Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trigger events in iframe's parent window

Tags:

Why is the following not working:

//iframe: window.parent.$(document).trigger('complete');  //parent window: $(document).bind('complete', function(){   alert('Complete'); }); 

while the following IS working:

//iframe: window.parent.$('body').trigger('complete');  //parent window: $('body').bind('complete', function(){   alert('Complete'); }); 

?

like image 862
Vincent Avatar asked Jan 05 '11 06:01

Vincent


1 Answers

The way events are tracked, you can only trigger or receive events on the same document.

try

window.parent.$(window.parent.document).trigger('complete'); 
like image 143
moribvndvs Avatar answered Oct 07 '22 23:10

moribvndvs