问题
First the two page in under the same domain
In the parent page.htm I have only a element like input#test
,
then I set a iframe in the parent page,called child.htm,in the child.html I write js to find the parent input element,like
var parent = window.self.top;
but I can't use var input = $(parent).find('input#test')
to find the input element in parent.htm
Can I access to it? How can I achieve that?
回答1:
Try
var input = $(window.self.top).contents().find('input#test');
or
var input = $(window.self.top.document).find('input#test');
来源:https://stackoverflow.com/questions/10792401/can-i-access-to-iframe-s-parents-element-from-the-iframe-page