Reputation: 29
I want to put a container for my tables
<div class="single-post-content">
<div class="responsive-tables">
<table></table>
</div>
</div>
To do this I wrote the following code:
$('.single-post-content').find('table').before('<div class="responsive-tables">');
$('.single-post-content').find('table').after('</div>');
But this is how it is created:
<div class="single-post-content">
<div class="responsive-tables"></div>
<table></table>
</div>
please guide me.
Upvotes: 0
Views: 134
Reputation: 895
You can use the jQuery function .wrap
$('.single-post-content').find('table').wrap('<div class="responsive-tables"></div>');
Reference: http://api.jquery.com/wrap/
Upvotes: 3