jQuery: find a last child that has specific class

前端 未结 1 1112
遥遥无期
遥遥无期 2021-01-18 01:52

If I have deep nested unordered list and I have a reference to the root node, is there a built in way to find a last child of \"li\" type that has specific css class? For ex

1条回答
  •  北海茫月
    2021-01-18 02:29

    Not too hard:

    $("li.someclass", rootOfList).last()
    

    searches rootOfList for the last li with class someclass

    0 讨论(0)
提交回复
热议问题