[英]How can I remove elements in an iframe using JQuery?
我已將鏈接元素添加到iframe的(ivuFrm_page0ivu1)內容中,並希望在選擇按鈕時刪除這些內容。 我正在使用的代碼在這里:
function removeAddedElements(){
console.log("called removeAddedElements()");
$("#ivuFrm_page0ivu1").contents().find(".linkUp").each(function (index, element) {
$(this).remove
console.log("removed one linkUp");
});
}
它遍歷我擁有的四個元素,但不會刪除它們。 它們保持可見。 我怎樣才能刪除這些?
.remove
不是jquery
的有效函數。 試試$(this).remove()
function removeAddedElements(){
console.log("called removeAddedElements()");
$("#ivuFrm_page0ivu1").contents().find(".linkUp").each(function (index, element) {
$(this).remove()
console.log("removed one linkUp");
});
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.