[jQuery] Re: Remove an element but not it's content

2009-08-06 Thread Eric Garside
If you want a cleaner look, you can always just throw together a quick plugin to handle things: $.unwrap = function(){ return this.each(function(){ var el = $(this); el.before( el.html() ).remove(); }) } Then, simply call: $('a.tester').unwrap(); And it will unwrap all

[jQuery] Re: Remove an element but not it's content

2009-08-06 Thread piter
Hi, Not sure if sent the post but Solution is quite easy (I wouldnt even use jQuery for this): For re-use purposes create function: function rmTags(ref){ ref.parentNode.insertBefore( document.createTextNode (ref.innerHTML), ref); return ref.parentNode.re

[jQuery] Re: Remove an element but not it's content

2009-08-06 Thread piter
?? Why u wanna use jQuery for this? It's simple thing in JS: assuming your rference to link will be: var theLink; just do this: theLink.parentNode.insertBefore( document.createTextNode (theLink.innerHTML), theLink); theLink.paren

[jQuery] Re: Remove an element but not it's content

2009-08-06 Thread paulswansea
Hi, Tried both those methods. the plugin ended up deleting all siblings, and replacewith cant replace it with nothing, but made my own quick and dirty solution should anyone ever want to know the solution : ***This is a test--- //

[jQuery] Re: Remove an element but not it's content

2009-08-06 Thread Richard D. Worth
It's not built-in, but there are plugins for it: http://www.google.com/search?q=jquery+unwrap Or you could use replaceWith: http://docs.jquery.com/Manipulation/replaceWith - Richard On Thu, Aug 6, 2009 at 10:42 AM, paulswansea wrote: > > I'm trying