On Tue, Mar 2, 2010 at 9:20 AM, debussy007 <[email protected]> wrote:
> I would like to have the previous TD element with class "time".
>
> I tried : $(this).closest('td').prev('td.time').html() (where "this" is a
> div element inside a TD)
> But it only works for a div inside a TD that is *directly* following the
> td.time element.
Yeah, prev only gets the immediately preceding sibling; prevAll gets
all previous siblings so I think you want something like this:
$(this).closest('td').prevAll('td.time').last().html()
Nathan