select last child of element that does not have a certain class

后端 未结 4 1820
谎友^
谎友^ 2021-01-16 19:23

I am try to select the last element of a child that does not have a certain class. I have setup a js fiddle.

4条回答
  • 2021-01-16 19:31

    You have to do the not prior to the last:

    $("aside.col2 div:not('.quotebox'):last")
    

    http://jsfiddle.net/VATaj/1/

    0 讨论(0)
  • 2021-01-16 19:31
    $("aside.col2 div:last:not(.infobox)")
    
    0 讨论(0)
  • 2021-01-16 19:34
    $("aside.col2 :not(.quotebox)").last().addClass("last-round");
    

    Select all of the ones that don't have the class, THEN get the last one.

    0 讨论(0)
  • 2021-01-16 19:50
    $("aside.col2 div").not('.quotebox').last();
    
    0 讨论(0)
提交回复
热议问题