jquery selector - exclude first and second

前端 未结 5 1952
无人共我
无人共我 2021-02-13 11:56

I want to exclude first and second element from jquery selector. I tried this:

$(\'p:not(:nth-child(1),:nth-child(2))\')

But this only excludes

5条回答
  •  悲哀的现实
    2021-02-13 12:04

    try:

    $('p:not(:nth-child(1)),p:not(:nth-child(2))')
    

    Reference: http://www.w3.org/TR/selectors/#negation

    from that reference: "The negation pseudo-class, :not(X), is a functional notation taking a simple selector (excluding the negation pseudo-class itself) as an argument...."

提交回复
热议问题