Home > Article > Web Front-end > JQuery operates elements and methods of iframe parent page and child page (explanation with examples)_jquery
JQUERY IFRAME
The following simply uses Jquery to operate some records of the iframe. This can be achieved using pure JS.
First, how to find the parent page element in an iframe:
$('#id', window.parent.document)
Second, get the elements in the iframe in the parent page:
$(this).contents().find("#suggestBox")
Third, call the methods and variables defined in the parent page in the iframe:
parent.method
parent.value
Use jquery to get the parent page in the iframe body
iframe.html