I have this:
<ul>
<li><a href="http://link.com">Link 1</a></li>
<li class="remove-me"><a>Link 2</a></li>
<li><a href="http://link.com">Link 3</a></li>
</ul>
And I’d like this:
<ul>
<li><a href="http://link.com">Link 1</a></li>
<li class="remove-me">Link 2</li>
<li><a href="http://link.com">Link 3</a></li>
</ul>
How can I acheive this with jquery? I thought $('.remove-me').removeAttr('a'); but that’s not it?
Try$('.remove-me a').remove().Edit: I see that you want to preserve the contents of the
aelement(s). In that case, usingreplaceWith()should work: