Home  >  Article  >  Web Front-end  >  Several ways to parse Jquery to obtain elements in iframe_jquery

Several ways to parse Jquery to obtain elements in iframe_jquery

WBOY
WBOYOriginal
2016-05-16 17:30:161392browse

DOM method:
Parent window operation IFRAME: window.frames["iframeSon"].document
IFRAME operation parent window: window.parent.document
jquery method:
Select all input boxes in the IFRAME in the parent window: $(window.frames["iframeSon"].document).find(" :text");
Operation in IFRAME to select all input boxes in the parent window: $(window.parent.document).find(":text");
iframe HTML:

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

2. Select all radio buttons in the parent window in the IFRAME
$(window.parent.document).find("input[@type='radio']") .attr("checked","true");
iframe frame:

Copy code The code is as follows:

jquery-1.2.6.js" src="../js/jquery-1.2.6.js" type="text/ecmascript">