gpt4 book ai didi

jQuery 选择器 : selecting the body tag of an iframe

转载 作者:行者123 更新时间:2023-12-01 04:29:55 25 4
gpt4 key购买 nike

我有以下标记,将针对几个问题重复使用

<p id="questionOne">What are your tasks?</p>

<p id="copyLastYear"><a href="#">Copy from last year</a></p>

<div id="anserOne">
<div class="cleditorMain">
<div><!-- Editor tags here --></div>
<iframe>
<html>
<head></head>
<body></body>
</html>
</iframe>
</div>
</div>

当有人点击去年链接的副本时,我需要在正文中设置 html,其中包含去年答案的详细信息。

我遇到的问题是选择正文标签

我尝试了以下方法,但没有成功

$('#answerOne .cleditorMain iframe html body').html('<p>New HTML value</p>');

任何人都可以帮忙解决这个选择器部分吗?

最佳答案

您需要使用contents() 。像这样的东西应该有效。

$('#answerOne .cleditorMain iframe').contents().find('body').html('<p>New HTML value</p>');

关于jQuery 选择器 : selecting the body tag of an iframe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3500702/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com