Home > Web Front-end > JS Tutorial > body text

JQuery operates elements and methods of iframe parent page and child page (explanation with examples)_jquery

WBOY
Release: 2016-05-16 17:14:04
Original
940 people have browsed it

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

Copy code The code is as follows:




 
it is a iframe

               (window.parent.document.body) //Troublesome method: var c = $($(window).eq(0)[0].parent.document).find('body'); , I forgot to use it The previous method

alert(c.html());
}
);





Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template