开发者

How do you access the one iFrame on a page when you don't know the name or ID?

开发者 https://www.devze.com 2022-12-27 15:35 出处:网络
Given an html page with: <iframe frameborder=\"0\" allowtransparency=\"true\" tabind开发者_运维知识库ex=\"0\" src=\"\"

Given an html page with:

<iframe frameborder="0" allowtransparency="true" tabind开发者_运维知识库ex="0" src="" 
        title="Rich text editor, editor_kama, press ALT 0 for help." 
        style="width: 100%; height: 100%;">
  <html>
    <body><p>replace me</p></body>
  </html>
</iframe>

How can I access the iFrame assuming I can't give the iFrame a name or ID since it's made dynamically and also assuming that there is always only one iFrame on the page?

I'd like to be able to replace everything in the body tag within the iFrame with "found me" or something like that.

Any ideas?


Try a tag selector

$("iframe")

See Element Selector

0

精彩评论

暂无评论...
验证码 换一张
取 消