[英]How to remove iframe body class (JQuery / JS)
我有以下代碼:
<ul class="heroBx">
<li>
<iframe width="980" height="370" src="heroBanner/heroElantra/index.html" frameborder="0" scrolling="no"></iframe>
</li>
<li>
<iframe width="980" height="370" src="heroBanner/heroH1/index.html" frameborder="0" scrolling="no"></iframe>
</li>
<li>
<iframe width="980" height="370" src="heroBanner/heroStarex/index.html" frameborder="0" scrolling="no"></iframe>
</li>
<li>
<iframe width="980" height="370" src="heroBanner/heroTucson/index.html" frameborder="0" scrolling="no"></iframe>
</li>
<li>
<iframe width="980" height="370" src="heroBanner/heroVeloster/index.html" frameborder="0" scrolling="no"></iframe>
</li>
</ul>
我可以刪除iframe肢體類嗎? 謝謝。
document.querySelectorAll('.my #awesome selector');
和
el.classList.remove(className);
http://youmightnotneedjquery.com/
因此,如果您想通過JavaScript從DOM中的所有ul
元素中刪除heroBx
類:
var uls = document.querySelectorAll('ul');
for(var i = 0; i < uls.length; i++) {
uls[i].classList.remove('heroBx');
}
如果只有一個ul
目標,你可以而不是簡單的:
var ul = document.querySelector('ul');
ul.classList.remove('heroBx');
嘗試這個:
$('#iframe').contents().find('body').attr('class','');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.