gpt4 book ai didi

jquery - 在没有 id 的 div 中查找特定标签

转载 作者:可可西里 更新时间:2023-11-01 14:48:27 25 4
gpt4 key购买 nike

我正在使用 jquery 并试图找到一个 <html>嵌入在 <object> 中的标签.我正在尝试使用查找方法,但找不到。有人可以指导吗。

代码:

if (dialogObject.find('head')) {
var findelemnt = $('#dialogObject').find('html');
var testthis = findelemnt.attr("class");
alert(testthis);
}
else { alert("not found") }

dialoObject 是一个 <div> .附上页面的屏幕截图。

enter image description here

最佳答案

我认为这可能由于 same origin policy 而失败.参见 https://stackoverflow.com/a/14453363/560114 .

尝试使用本地 URL - 我猜您可以使用以下代码让它在那里工作:

$('#dialogObject')[0].contentDocument

关于jquery - 在没有 id 的 div 中查找特定标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25129338/

25 4 0