使用 Jquery 更改 iframe 中的 div

use*_*814 2 html javascript iframe jquery

我有一个“页面A”。在此页面中iframe显示“页面B”。

\n\n
<iframe id="iframeD" src="https://trello.com" width="600" height="600">\n  <p>Your browser does not support iframes.</p>\n</iframe>\n<div id="cTitle">Hello</div>\xe2\x80\x8b\n
Run Code Online (Sandbox Code Playgroud)\n\n

(请参阅以下小提琴的工作示例:http://jsfiddle.net/noscirre/yYkUN/

\n\n

“Page B”包含一个divid landingHeader。如何在“页面 A”上创建 jQuery 调用,并将其替换div为另一个div(其内容在“页面 A”上找到)和 id cTitle

\n

Ano*_*oop 5

 $("iframe").contents().find("#dTitle").attr('id','cTitle').html($('#cTitle').html());
Run Code Online (Sandbox Code Playgroud)