gpt4 book ai didi

jquery - 在没有唯一 ID 的 div 标签中隐藏文本

转载 作者:行者123 更新时间:2023-11-28 16:27:23 26 4
gpt4 key购买 nike

我需要帮助来隐藏“Silver=#”和“Manual=#”文本。这些文本没有唯一 ID,所以我不知道如何隐藏这些文本。请帮忙。您可以在此处查看此特定页面 --> https://www.colonialacres.com/product-p/wbs-g8-y.htm

enter image description here

最佳答案

您可以从 DOM 中删除它们:

$('[itemprop="offers"]').contents().filter(function () {
return this.nodeType == 3 && this.data.match(/Silver|Manual/);
}).remove();

或者用 span 和 hide 包裹它们:

$('[itemprop="offers"]').contents().filter(function () {
return this.nodeType == 3 && this.data.match(/Silver|Manual/);
}).each(function(i, el) {
$(el).replaceWith($('<span>').text(el.data).css('display', 'none'));
});

关于jquery - 在没有唯一 ID 的 div 标签中隐藏文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42229168/

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