Be aware that closest() returns the element itself if no match is
found. I prefer to use $(el).parents('xx:first') to avoid that.

Peter, no jQuery method will return null. If nothing is found it will
return an empty collection (length == 0).

On May 27, 2:03 pm, dabear <bjorni...@gmail.com> wrote:
> The closest()-method (available since jquery 1.3) would be ideal here,
> as it stops searching when an element matching the expression is
> found. See also:http://docs.jquery.com/Traversing/closest
>
> Please also note that ids are unique within a document, so just $
> ("#test0") should be fast enough.
>
> On May 27, 4:58 pm, Peter Marino <marino.pe...@gmail.com> wrote:
>
>
>
>
>
> > hi,
> > did not see the parents() method before now.. it does look this is what I
> > need.. will check when I get home from work... thanks
>
> > peter
>
> > On Wed, May 27, 2009 at 4:49 PM, M.M. <mario.maru...@gmail.com> wrote:
>
> > > On May 27, 2:19 pm, Peter Marino <marino.pe...@gmail.com> wrote:
> > > > Hi jQuery Group,
> > > > is it possible find a node backwards instead of forwards.
>
> > > isn't that parents()? (not parent, parents :)
>
> > >http://docs.jquery.com/Traversing/parents
>
> > --
> > Power Tumbling -http://www.powertumbling.dk
> > OSG-Help -http://osghelp.com

Reply via email to