jquery has a function .wrapAll() which is used to wrap around all divs with same class.
but I want to do exactly inverse of this means unwrap multiple divs with same class in single go as there is no unwrapAll() function there??
Is it possible to do???
E.g. Before
<div class="outer">
<div class="inner">foon</div>
<div class="inner">foon2</div>
<div class="inner">foo3</div>
</div>
after:
<div class="inner">foon</div>
<div class="inner">foon2</div>
<div class="inner">foo3</div>
Working example using suggested answer : http://jsfiddle.net/ScdLX/4/
You can do something like:
That does not remove text node children of
.outerDiv, though.http://jsfiddle.net/ScdLX/2/
EDIT: per @NullPointer you can do this using the
.unwrapmethod on the children of the parent selector. Please see:http://jsfiddle.net/ScdLX/3/