1

我正在将一个对象嵌入到我的网站上,并希望从中删除一个 div。那可能吗?我想用 jQuery 删除对象标签内具有特定 id 的 div。我尝试了下面的 jQuery,但它没有选择嵌入对象内的 div。

$("div").filter(function(){
console.log(this.id); // i don't see any of the id's from the div's inside my object 
});

编辑:

<object data=http://www.msn.com width='100%' height='100%'>
<embed src=http://www.msn.com width='100%' height='100%'>
</embed> Error: Embedded data could not be displayed. </object>

我需要在我的网站上删除嵌入对象内的 div。

请帮忙。

谢谢

4

1 回答 1

1
$(this).attr('id')  // $(this)  is jQuery Object

或者

this.id //  this is DOM Object

/

$("div").filter(function(){
       return this.id != 'div1' && this.id != 'div2' ;
}).css('backgroundColor' , 'orange')​

检查小提琴

于 2012-11-20T19:10:26.860 回答