Code to get iframe in jquery _jquery

Source: Internet
Author: User
The parent window operates iframe:window.frames["Iframechild"].document//If the IFRAME ID is iframechild

To manipulate the parent window in a child window: window.parent.document

So, how do we use jquery to get an IFRAME if we want to use jquery? Here is a collection of methods.

The object that gets the page is actually the selector for jquery outside the DOM method:

The parent window operates iframe:$ (window.frames["Iframechild"].document)//If the IFRAME ID is iframechild

To manipulate the parent window in a child window: $ (window.parent.document)

You can then continue to get the DOM within the IFRAME.

There are two ways to get DOM objects within an IFRAME

1 $ (window.frames["Iframechild"].document). Find ("#child")

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

1. Action in the parent window select all radio buttons in the IFRAME
$ (window.frames["Iframechild"].document). Find ("input[@type = ' Radio ']"). attr ("Checked", "true");
2. Operation in iframe Select all radio buttons in the parent window
$ (window.parent.document). Find ("input[@type = ' Radio ']"). attr ("Checked", "true");

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.