My stab at it:
$.fn.unwrap = function(expr) {
return this.each(function(){
$(this).parents(expr).eq(0).after(this).remove();
});
};
Then you could do:
$("#keepMe").unwrap("span");
Untested, but worth a shot.
--John
> wonder what you all use or could use, to UNWAP a tag,
> after its been its been added with teh $.wrap() function
>
> for example:
> <span id="removeMe"><P id="keepMe"> text </P>etc.. </span>
>
> so lets say you wanted to just keep the P tag, and unwarp the it, (drop
> span tag)? would be nice to just to do something like...
> $('removeMe').unwarp();
> in turn would result in ..<P id="keepMe"> text </P> etc...
>
> what to drop only the span tag without too much effort., any quick or
> easy already exciting function that do this?
> thanks,
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/