Hi Dave,
Not sure if this has been answered yet, but here is how I would do it:

$(this).parents('#inner')

Or, if you don't know what the DIV will be called, you could try it this way:

$(this).parents('div:eq(0)')


--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Feb 20, 2007, at 6:02 PM, <[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
[email protected]
http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to