In the follow content I need to remove the mark-up tags <div class="sub"> and </div> but not it’s content with jquery. This is to adapt the menu to a responsive layout.
<nav id="top">
<ul>
<li class="ti" id="snw"> <a class="mm" href="/snowdepth/">Weather</a>
<div class="sub">
<ul>
<li><h2>Snowline</h2></li>
<li><a href="/alpen/nordliche%20ostalpen/">Nordliche Ostalpen</a></li>
</ul>
</div>
</li>
<li class="ti" id="blg"> <a class="mm" href="/live/">Weblog</a></li>
</ul>
</nav>
Try unwrap():
Essentially, you are looking for all the child elements of
.sub, and unwrapping them or removing their parent.Here’s the demo: http://jsfiddle.net/yEseX/