Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 id 为“test”的 div。里面是一个没有 id 的 iframe。我需要访问这个 iframe 的正文内容。如何使用 JS/Jquery 做到这一点?
像这样访问它:
$('#test>iframe').contents.find('body') // This will get you body tag
jquery 会做到的。
var objiframe=$('#test').find('iframe');
你会进去iframe的objiframe
iframe
objiframe
然后使用objiframewith 选择器来获取或设置 iframe 的属性和内容。