$(this).parents('div#inner') Note that parents() returns _all_ the ancestors of the element (in order of parent, grandparent, great-granparent, etc) so you need to add that "filter" of 'div#inner' to it so that it will only return the one.
Karl Rudd On 2/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > > If I have a "this.id" reference to an element in my DOM, how would i get its > parent node? > > More challenging, how would I get the first DIV node that the element is in? > That is, it may be nested within an arbitrary number of table cells, but > there is a DIV lurking at the top ... > > <div id="outer"> > <div id="inner"> > <table> > <tr><td> > <table> > <tr><td><!-- here's the element --> > > In the example here, I would like to get a reference to the DIV with ID = > "inner". > > Thanks, you guys are the best, - Dave > > _______________________________________________ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/