我想在单击iframe子元素时删除iframediv元素。我想关闭div内的谷歌广告时,该广告被点击。我该怎么做呢?
这是我的HTML文档:
<div class="iframediv">
<iframe src="otherdomin.com/page2"></iframe>
</div>
<div class="iframediv">
<iframe src="otherdomin.com/page"></iframe>
</div>发布于 2016-07-04 00:46:49
使用JQuery的hide或remove方法
<div class="iframediv" id="div1">
<iframe src="otherdomin.com/page2" id="iframe1"></iframe>
</div>
<div class="iframediv" id="div2">
<iframe src="otherdomin.com/page" id="iframe2"></iframe>
</div>
<script>
$('#iframe1').click(function(){
$('#div1').hide();
//$('#div1').remove();
});
</script>https://stackoverflow.com/questions/38132208
复制相似问题