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

Code to get iframe in Jquery_jquery

WBOY
Release: 2016-05-16 18:12:24
Original
905 people have browsed it

Operate the iframe in the parent window: window.frames["iframeChild"].document //If the id of the iframe is iframeChild

Operate the parent window in the child window: window.parent.document

Then , if we want to use jquery, how do we use jquery to get the iframe? Here's how to collect it.

The object to obtain the page is actually adding the jquery selector outside the dom method:

Operation iframe in the parent window: $(window.frames["iframeChild"].document) //If The id of the iframe is iframeChild

Operate the parent window in the child window: $(window.parent.document)

Then you can continue to obtain the dom in the iframe.

There are two ways to get the DOM object in the iframe

1 $(window.frames["iframeChild"].document).find("#child")

2 $("#child",window.frames["iframeChild"].document)

1. Select all radio buttons in the IFRAME in the parent window
$(window.frames[" iframeChild"].document).find("input[@type='radio']").attr("checked","true");
2. Select all radio options in the parent window in IFRAME Button
$(window.parent.document).find("input[@type='radio']").attr("checked","true");

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!