Exclusive CSS selector

后端 未结 3 1870
夕颜
夕颜 2020-12-07 03:53

I am working on a page where the selected item among a list is characterized by NOT having a given class. Something like the following:

3条回答
  •  孤城傲影
    2020-12-07 04:25

    Apart from Temanis answer you can use the not selector in this case

    document.querySelectorAll('li.a:not(.b)')
    

提交回复
热议问题