If you want the parent as a jQuery object:

    $('#something').parents('div').eq(0)

If you want it as a "raw" DOM element:

    $('#something').parents('div')[0]

Note that parent() only returns the parent object, not the parent,
grandparent, great-grandparent, etc objects.

Karl Rudd

On 1/16/07, Chris Domigan <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> How would I select the first ancestor of a certain type? Eg if I want to
> select the first div that is found while searching up the DOM from an
> element.
>
> Cheers,
>
> Chris

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to