gpt4 book ai didi

javascript - 如何删除 iframe 主体类 (JQuery/JS)

转载 作者:行者123 更新时间:2023-11-30 06:53:32 25 4
gpt4 key购买 nike

我有这个代码:

<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 选择器');

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');

关于javascript - 如何删除 iframe 主体类 (JQuery/JS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24380388/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com