Having jQuery inside of an iframe modify the parent window
i have a page which has an iframe.
in the iframe, I want jQuery to remove an element from the patent page, so I'm trying:
parent.$('#att开发者_运维百科achment-134').remove();
But that doesn't work. Any ideas? thanks
Should be:
$(parent.document).find('#attachment-134').remove();
This of course only remains true, if the iframe and the parent have the identical domain. Otherwise the SOP (Same Origin Policy) would deny the access.
Example: http://jsbin.com/eqise5
精彩评论