Home >Web Front-end >JS Tutorial >How to get parent page elements from iframe subpages
Get the elements of the parent page in the iframe subpage
The code is as follows:
$.('#objld', parent.document);
Get the elements of the iframe subpage in the parent page
The code is as follows:
$("#objid", document.iframes('iframe').document)
or
$(document.getElementById('iframeId').contentWindow.document.body).html() $(document.getElementById('iframeId').contentWindow.document.body).html()
Display the content of the body element in the iframe
$("#testId", document.frames("iframename").document).html()
For more articles on how to obtain parent page elements from iframe subpages, please pay attention to the PHP Chinese website!