gpt4 book ai didi

jquery - 查找具有特定属性和特定值的项目

转载 作者:行者123 更新时间:2023-12-01 05:00:41 26 4
gpt4 key购买 nike

我正在尝试查看具有特定属性值的列表项是否不存在。此代码将帮助我查找具有特定属性的项目,但如何修改它以检查是否不存在将该属性设置为特定值的列表项?例如,如果 someAttributeName = Exist 的项目不存在,则...

$(parentElement).find('*[someAttributeName]').each(function(index){
doSomething(this); });

最佳答案

$('*:not([someAttributeName="value"]) 

这将返回所有不具有特定值的属性的元素。请参阅jQuery Not Equals Selector了解更多详情。

关于jquery - 查找具有特定属性和特定值的项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10468719/

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