gpt4 book ai didi

jquery。如果链接的 href 中包含 'text'。隐藏链接

转载 作者:行者123 更新时间:2023-12-01 07:34:20 25 4
gpt4 key购买 nike

有一个 asp 转发器,它在具有不同 url 的页面上重复链接。我想隐藏 href 中包含“文本”一词的任何链接(使用 jquery)。我怎样才能做到这一点?

if($(".fsproductsStcokistButton:contains('text')"))
{
$(this).css("display", "none");
}

最佳答案

你可以像这样链接它:

$(".fsproductsStcokistButton:contains('text')").hide();

.hide()display: none; 的快捷方式,选择器本身只会返回包含该文本的元素,所以一切都准备好了。对于属性检查,例如 href,请使用 attribute-contains selector ,像这样:

$(".fsproductsStcokistButton[href*='text']").hide();

关于jquery。如果链接的 href 中包含 'text'。隐藏链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3710065/

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