Right on! How incredibly simple. I put *way* too much thought into
that. Thanks a ton, Riyono!

On Oct 2, 9:01 pm, "Andronicus Riyono" <[EMAIL PROTECTED]> wrote:
> On Fri, Oct 3, 2008 at 6:13 AM, jkappers <[EMAIL PROTECTED]> wrote:
>
> > I've got a bit of a problem. I'm attempting to wrap an element, and
> > then retrieve the element + the new element added on wrap. For
> > example:
>
> > $("element").wrap("div");
>
> > The wrap function will return $("element") again, but what if I want
> > to include the div I just wrapped around $("element") into a new
> > Jquery object?
>
> That's because the wrap method only do it's job (which is, wrapping
> the element with a div)
>
>
>
> > The html used in the wrap() function is dynamic, it can be anything,
> > so I can't just select it by doing $("div element") after the wrap.
>
> > Any advice on the matter is *greatly* appreciated.
>
> To do the next step (looking for element's parent) you'll need to use parent()
>
> for example:
>
> $("p").wrap("<div></div>").parent()
>
> that will return 'div';
>
> Regards,
> Riyono
>
> --
> ---------------------------------------------
>  There's nothing impossible for an open mind
> ---------------------------------------------

Reply via email to