gpt4 book ai didi

jQuery - :not selector 内不区分大小写的值

转载 作者:行者123 更新时间:2023-12-01 08:09:52 27 4
gpt4 key购买 nike

我正在文档中选择表格行列表。

以下代码选择:

  1. 所有表格行...
  2. 包含类 .val-string 的 DIV
  3. 具有保存值“null”的子输入

$('tr').children('.val-string').children('input'):not([value!=null])').each(function(k,v) { });

这适用于选择包含值“null”的那些输入,但我也希望它适用于“Null”、“NULL”甚至“nUlL”。

我尝试过使用:

...children('input'):not([value.toLowerCase()!=null])') ...

toLowerCase() 函数的其他变体/位置。

基本上,我所要求的内容可以在一行代码中执行吗?就像我上面尝试执行的那样?

This link似乎建议使用修改 :contains 函数,但我不想为我的所有代码更改此函数,因为它在其他地方使用并且需要区分大小写。

最佳答案

没有选择器,但您可以使用过滤器

$('tr .val-string input').filter(function(){  
return this.value.toLowerCase() =='null';
}).doSomething();

关于jQuery - :not selector 内不区分大小写的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14337361/

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