gpt4 book ai didi

jQuery - 根据类名删除 DIV

转载 作者:搜寻专家 更新时间:2023-10-31 02:25:47 24 4
gpt4 key购买 nike

是否可以通过 jQuery 删除页面上的所有 DIV——保持它们的内容完整——它们具有这种模式?

<div class="ExternalClass85AC900AB26A481DBDC8ADAE7A02F039">....</div>

请注意,DIV 遵循以下模式:

  • 类名将始终以 ExternalClass 开头,但后面会跟另一个值,永远不会相同,

  • 并且 DIV 除了 class 没有其他属性。 (这是在 SharePoint 上)

谢谢。

最佳答案

是的,您可以使用 attribute starts with selectorreplaceWith方法:

$('[class^="ExternalClass"]').filter(function() { 
return this.attributes.length === 1;
}). replaceWith(function() {
return $(this).html();
});

关于jQuery - 根据类名删除 DIV,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9163023/

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