<< Back to All Posts

0
Post_box 12 years ago
How do I remove the div tags with jQuery?
64d085d3791437b311d860dd5bdb8a95
64d085d3791437b311d860dd5bdb8a95 Member Since: Aug 2012
Prince Gill
Posted on September 27,2012 by Prince
<div>
 <p><a href="link">Some Link</a></p>
</div>

output:

<p><a href="link">Some Link</a></p>
1 comment
Posted in jquery
1
12 years ago
Lance Carletti
053e75a6e442eae82191b5136bb1bdb0
053e75a6e442eae82191b5136bb1bdb0 Member Since: Sep 2012
Lance Carletti
Commented on September 27,2012

use replaceWith() to replace an element with its contents:

$('div').replaceWith(function(){
    return $(this).contents();
});
Reply
Please login to comment