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 reference to one of the "li" I need to find all parent "li" up to a root "ul". If I use parents() it gives me all parents up to a root of document. One way would be just to write recursive function and check for id of the parent, but if there is something built in I would rather use that.
A:
Parents Until should work for that. I think you need jQuery 1.4 to use it though.
rosscj2533
2010-01-21 21:19:50
Cool, I'll have to upgrade to 1.4
epitka
2010-01-21 21:22:44
Yeah, it definitely is version 1.4 only. Upgrading (hopefully) shouldn't be a big problem though.
rosscj2533
2010-01-21 21:41:35