Home > Web Front-end > JS Tutorial > jQuery gets the IFrame and its parent window object and uses

jQuery gets the IFrame and its parent window object and uses

php中世界最好的语言
Release: 2018-04-26 15:41:43
Original
1943 people have browsed it

This time I will bring you jQuery to obtain and use IFrame and its parent window object. What are the precautions for jQuery to obtain and use IFrame and its parent window object. The following is a practical case, let's take a look.

In web development, iframes are often used. It is inevitable that you need to use elements in the iframe in the parent window, or use elements of the parent window in the iframeframe
Get the elements in the iframe in the parent window

格式:$("#iframe的ID").contents().find("#iframe中的
控件
ID").click(); 
实例:$("#ifm").contents().find("#btnOk").click();
Copy after login

Get the elements in the parent window in the iframe

格式:$('#父窗口中的元素ID', parent.
document
).click(); 
实例:$('#btnOk', parent.document).click();
Copy after login

I believe you have mastered the method after reading the case in this article, and more How exciting, please pay attention to other related articles on php Chinese website!

Recommended reading:

How jquery makes iframe adaptive to the front-end height

jQuery cross-domain operation DOM method in iframe

JSONP solves ajax cross-domain problem (with code)

The above is the detailed content of jQuery gets the IFrame and its parent window object and uses. For more information, please follow other related articles on the PHP Chinese website!

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