[jQuery] Find ancestor element
Hi all,
I am trying to get a specific ancestor for a given element. Not the
direct parent element but maybe some levels higher up the DOM.
An example:
<div id="outer">
<div id="inner">
<span>
<input type="checkbox" id="cb" /> caption
</span>
</div>
</div>
I only know that "cb" exists, now I need a handle on the "nearest"
ancestor. To make it more clear: I have absolutely no clue about the
actual nesting level. I only have the id of the checkbox and need to get
the nearest div-ancestor, wherever it may be.
I have looked here: http://jquery.com/docs/XPath/
...but couldn't find a solution, at least it wasn't obvious to me. Is
there an easy solution with JQuery or do I need to bake it myself?
Thanks & greetings,
Arash
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/