gpt4 book ai didi

javascript - JS/jQuery : Hiding elements which doesnt have a spesific attribute value

转载 作者:行者123 更新时间:2023-11-29 17:01:39 25 4
gpt4 key购买 nike

<div class="picture" picturename="picture of a horse and stuff"></div>

下面的代码将有效地隐藏属性 picturename 包含“马”的所有元素:

$('[picturename*="horse"]').hide();

但是我如何隐藏属性 picturename 不包含“马”的所有元素?你会想添加一个!在 = 之前可以解决问题,但不行。

最佳答案

$('.picture').not('[picturename*="horse"]').hide();

这应该可以。

关于javascript - JS/jQuery : Hiding elements which doesnt have a spesific attribute value,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26946177/

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