[英]Inserting an iframe into the bottom of a div
我正在嘗試將使用jQuery的iframe
插入div
,以下代碼可以完成該操作,但它會刪除div#off
中的所有內容。 如何將iframe
設置在div#off
內容的底部,而不是刪除所有內容? 可能嗎?
$(document).ready(function() {
$("#off").html("<iframe src='http://images.findel-education.co.uk/EmailSignup/website_email_sign_up.html'>></iframe>");
});
我無法控制父窗口,所以這就是為什么我必須這樣做。
.html()
將替換您元素的所有當前HTML標記,您想改用.append() :
將參數指定的內容插入到匹配元素集中每個元素的末尾。
$(document).ready(function() {
$("#off").append("<iframe src='http://images.findel-education.co.uk/EmailSignup/website_email_sign_up.html'>></iframe>");
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.