鍍金池/ 問答/HTML/ 怎么向iframe中追加元素和事件呢

怎么向iframe中追加元素和事件呢

現在想想iframe里追加關閉按鈕

<iframe id="iframe" class="iframe" src="https://www.imanet.org.cn/e/" frameborder="0" scrolling="no">
</iframe>

  var close='<div class="close-survey" onclick="closesurvey()"></div>'
           
    $('#iframe').contents().find('body').append(close)

這么寫不行啊

回答
編輯回答
挽青絲
$('#iframe')[0].contentWindow.find('body')
2018年4月27日 19:22