【问题标题】:Question about jQuery Selectors关于 jQuery 选择器的问题
【发布时间】:2010-02-10 03:11:11
【问题描述】:

我想用 jQuery 选择除 myclass 之外的所有 h1 标签。例如我想选择 但我不想选择

谢谢

【问题讨论】:

    标签: jquery css css-selectors


    【解决方案1】:

    试试:not() selectornot method

    $("h1:not(.myclass)")
    $("h1").not(".myclass")
    

    【讨论】:

      【解决方案2】:
      $("h1:not('.myclass')")
      

      http://api.jquery.com/not-selector/

      【讨论】:

      • +1 用于链接到 API 参考。在此处插入“授人以鱼/授人以渔”作类比。
      猜你喜欢
      • 2011-10-12
      • 1970-01-01
      • 1970-01-01
      • 2019-09-02
      • 2010-10-09
      • 1970-01-01
      • 2011-04-04
      • 2011-10-31
      相关资源
      最近更新 更多