If you want to preserve other elements in the same parent, just change
html() to append/prepend:

$(this).parent().append( $(this).remove().html() );

On Jan 24, 11:33 am, BrainBurner <[email protected]> wrote:
> Thanks Stephan, your solutions works very well!
> I also thought, that rewrtiting the whole html of the container could
> overwrite other elements, but it is also a very original idea!
>
> Thank you both!
>
> On Jan 24, 2:22 pm, Stephan Veigl <[email protected]> wrote:
>
> > This solution is easier one if the parent element has only one element
> > - the span, if the parent element hase more spans (or other elements)
> > parent.html() would overwrite all elements and replace them with the
> > content of the child.
>
> > The performace might also be an issue, however I have no idea which
> > one is faster: html() od insertBefore().
>
> > by(e)
> > Stephan
>
> > 2009/1/24 Mike Alsup <[email protected]>:
>
> > >> I'm writing an effect, which has to build a span around my element,
> > >> but when my effect is finished I wanted to strip this span tag, in
> > >> order to leave the situation as it was before..
>
> > >> How can I strip a tag??
> > >> Is there something like: $(this).parent().strip(); ???
>
> > > In your example is 'this' the span?  If so, I'd try something like
> > > this:
>
> > > $(this).parent().html( $(this).html() );

Reply via email to