【问题标题】:Uncaught TypeError: selector is undefined未捕获的类型错误:选择器未定义
【发布时间】:2021-12-31 06:41:02
【问题描述】:

这部分 jQuery 代码有什么问题?

$(this).parents('.list-footer').prev().find('div').find(`div:not:contains('${this.value.trim()}')`).css('display', 'none');

它给出了这个错误

Uncaught TypeError: selector is undefined
    jQuery 7
    onkeyup http://localhost:3000/account:1
jquery-3.3.1.js:1927:15
    jQuery 7
    onkeyup http://localhost:3000/account:1

【问题讨论】:

    标签: jquery


    【解决方案1】:

    我刚刚发现 jQuery :not() 选择器必须与括号一起使用。

    div:not(:contains('${this.value.trim()}')
    

    【讨论】:

      猜你喜欢
      • 2021-05-13
      • 2021-08-11
      • 2020-12-21
      • 1970-01-01
      • 2022-07-04
      • 1970-01-01
      • 2021-11-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多