![](/img/trans.png)
[英]Inserting Text into a Designmode Iframe Triggered By a Button Outside the Iframe
[英]Inserting text into iFrame on page (copy from outside the iframe)
我正在嘗試使用頁面上的文本字符串預填充表單域。 但是該表格位於iframe中,因此很難。
這是有問題的頁面,但是您不會從鏈接中得到太多幫助,因為您的動態內容將為空。 此屏幕截圖可能會更好地說明: http : //prntscr.com/kbqoak
我試圖編寫一個Javascript將文本復制到該表單字段中:
$(document).ready(function() {
jQuery(".refer_webinar input").val($('.webinartitle').text());
)
}
它將從“ webinartitle”類中獲取文本,然后插入到表單字段( http://prntscr.com/kbqqp4 )中。 但是它不起作用,我懷疑是因為它在iframe中。
您能幫忙弄清楚是否有辦法在其中注入這些信息嗎? (如果它是可能的)
如果在iframe中,您可以這樣做...
$(function(){
$('iframe').contents().find('.refer_webinar input').val($('.webinartitle').text());
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.