jQuery: find all the parents up to a specific parent

前端 未结 2 1688
说谎
说谎 2021-01-21 00:28

Is there a built in function in jQuery that would allow me to get all the parents up to a parent with specific Id? I have a deeply nested unordered list, and if I have a referen

相关标签:
2条回答
  • 2021-01-21 00:40

    $('li').closest('ul')

    0 讨论(0)
  • 2021-01-21 00:48

    Parents Until should work for that. I think you need jQuery 1.4 to use it though.

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